Commit 6292462f authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

[1638] add some more bad from-wire data tests. no need to fix the main code.

parent cfb3f053
......@@ -71,6 +71,19 @@ TEST_F(Rdata_NSEC3PARAM_Test, createFromWire) {
EXPECT_EQ(0, rdata_nsec3param.compare(
*rdataFactoryFromFile(RRType::NSEC3PARAM(), RRClass::IN(),
"rdata_nsec3param_fromWire1")));
// Short buffer cases. The data is valid NSEC3PARAM RDATA, but the buffer
// is trimmed at the end. All cases should result in an exception from
// the buffer class.
vector<uint8_t> data;
UnitTestUtil::readWireData("rdata_nsec3param_fromWire1", data);
const uint16_t rdlen = (data.at(0) << 8) + data.at(1);
for (int i = 0; i < rdlen; ++i) {
// intentionally construct a short buffer
InputBuffer b(&data[0] + 2, i);
EXPECT_THROW(createRdata(RRType::NSEC3PARAM(), RRClass::IN(), b, 9),
InvalidBufferPosition);
}
}
TEST_F(Rdata_NSEC3PARAM_Test, toWireRenderer) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment