src/net/dns/record_rdata_unittest.cc
// Test that we correctly reject a record with an ill-formed ESNI keys field.
//
// This test makes sure that the //net-side record parser is able
// correctly to handle the case where an external ESNI keys validation
// subroutine reports that the keys are ill-formed; because this validation
// will eventually be performed by BoringSSL once the corresponding
// BSSL code lands, it's out of scope here to exercise the
// validation logic itself.
Test that we correctly reject a record with an ill-formed ESNI keys field.
This test makes sure that the //net-side record parser is able
correctly to handle the case where an external ESNI keys validation
subroutine reports that the keys are ill-formed; because this validation
will eventually be performed by BoringSSL once the corresponding
BSSL code lands, it's out of scope here to exercise the
validation logic itself.
Test that we correctly reject a record with an ill - formed ESNI keys field . This test makes sure that the // net - side record parser is able correctly to handle the case where an external ESNI keys validation subroutine reports that the keys are ill - formed ; because this validation will eventually be performed by BoringSSL once the corresponding BSSL code lands it ' s out of scope here to exercise the validation logic itself .
TEST(RecordRdataTest, EsniMalformedRecord_InvalidEsniKeys) {
  char record[10000] = {};
  base::BigEndianWriter writer(record, sizeof(record));
  const char ill_formed_esni_keys[] = {
      0xff, 0x3,  0x0,  0x0,  0x0,  0x24, 0x0,  0x1d, 0x0,  0x20,
      0xed, 0xed, 0xc8, 0x68, 0xc1, 0x71, 0xd6, 0x9e, 0xa9, 0xf0,
      0xa2, 0xc9, 0xf5, 0xa9, 0xdc, 0xcf, 0xf9, 0xb8, 0xed, 0x15,
      0x5c, 0xc4, 0x5a, 0xec, 0x6f, 0xb2, 0x86, 0x14, 0xb7, 0x71,
      0x1b, 0x7c, 0x0,  0x2,  0x13, 0x1,  0x1,  0x4,  0x0};
  writer.WriteBytes(ill_formed_esni_keys, sizeof(ill_formed_esni_keys));
  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_InvalidEsniKeys ) { char record [ 10000 ] = { } ; base :: BigEndianWriter writer ( record , sizeof ( record ) ) ; const char ill_formed_esni_keys [ ] = { 0xff , 0x3 , 0x0 , 0x0 , 0x0 , 0x24 , 0x0 , 0x1d , 0x0 , 0x20 , 0xed , 0xed , 0xc8 , 0x68 , 0xc1 , 0x71 , 0xd6 , 0x9e , 0xa9 , 0xf0 , 0xa2 , 0xc9 , 0xf5 , 0xa9 , 0xdc , 0xcf , 0xf9 , 0xb8 , 0xed , 0x15 , 0x5c , 0xc4 , 0x5a , 0xec , 0x6f , 0xb2 , 0x86 , 0x14 , 0xb7 , 0x71 , 0x1b , 0x7c , 0x0 , 0x2 , 0x13 , 0x1 , 0x1 , 0x4 , 0x0 } ; writer . WriteBytes ( ill_formed_esni_keys , sizeof ( ill_formed_esni_keys ) ) ; 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 we correctly reject a record with an ill-formed ESNI keys field.
Test that we correctly reject a record with an ill - formed ESNI keys field .
// Oops! This otherwise well-formed ESNIKeys struct is missing its // final byte, and the reader contains no content after this incomplete // struct. /* offset */