src/net/dns/record_rdata_unittest.cc
// Test that an ESNI record with invalid address_set extension length is
// correctly rejected.
Test that an ESNI record with invalid address_set extension length is
correctly rejected.
Test that an ESNI record with invalid address_set extension length is correctly rejected .
TEST(RecordRdataTest, EsniMalformedRecord_BadAddressSetLength) {
  char record[10000] = {};
  base::BigEndianWriter writer(record, sizeof(record));
  AppendWellFormedEsniKeys(&writer);
  writer.WriteU16(4);  
  writer.WriteU16(EsniRecordRdata::kAddressSetExtensionType);
  writer.WriteU16(1);
  auto record_size = writer.ptr() - record;
  DnsRecordParser parser(record, record_size, 0 );
  std::unique_ptr<EsniRecordRdata> record_obj =
      EsniRecordRdata::Create(std::string(record, record_size), parser);
  ASSERT_THAT(record_obj, IsNull());
}
TEST ( RecordRdataTest , EsniMalformedRecord_BadAddressSetLength ) { char record [ 10000 ] = { } ; base :: BigEndianWriter writer ( record , sizeof ( record ) ) ; AppendWellFormedEsniKeys ( & writer ) ; writer . WriteU16 ( 4 ) ; writer . WriteU16 ( EsniRecordRdata :: kAddressSetExtensionType ) ; writer . WriteU16 ( 1 ) ; auto record_size = writer . ptr ( ) - record ; DnsRecordParser parser ( record , record_size , 0 ) ; std :: unique_ptr < EsniRecordRdata > record_obj = EsniRecordRdata :: Create ( std :: string ( record , record_size ) , parser ) ; ASSERT_THAT ( record_obj , IsNull ( ) ) ; }
Test that an ESNI record with invalid address_set extension length is
correctly rejected.
Test that an ESNI record with invalid address_set extension length is correctly rejected .
// 2 bytes for each of the U16s to be written // Oops! Length-prepending the empty address_set field with the value 1. /* offset */