Bug 1089393: Fix hex excape sequences ('\0x' -> '\x') in pkixnames_tests.cpp, r=mmc
authorBrian Smith <brian@briansmith.org>
Sun, 26 Oct 2014 11:29:42 -0700
changeset 213258 1d752af4a7142753b5a425e7d56b6fb0549012a9
parent 213257 715ded1f9639136c6cbee52b65d78b7898b1ad26
child 213259 a87664f1bad4162d635cc5e44a7d3c6fe89db388
push id51183
push userbrian@briansmith.org
push dateThu, 30 Oct 2014 23:51:00 +0000
treeherdermozilla-inbound@c7c48ab6ee5e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmmc
bugs1089393
milestone36.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1089393: Fix hex excape sequences ('\0x' -> '\x') in pkixnames_tests.cpp, r=mmc
security/pkix/test/gtest/pkixnames_tests.cpp
--- a/security/pkix/test/gtest/pkixnames_tests.cpp
+++ b/security/pkix/test/gtest/pkixnames_tests.cpp
@@ -325,19 +325,19 @@ static const InputValidity DNSNAMES_VALI
   I("a.xn--.", false, false),
   I("a.xn--.b", false, false),
   I("a.xn--.b", false, false),
   I("a.xn--\0.b", false, false),
   I("a.xn--a.b", true, true),
   I("xn--a", true, true),
   I("a.xn--a", true, true),
   I("a.xn--a.a", true, true),
-  I("\0xc4\0x95.com", false, false), // UTF-8 ĕ
+  I("\xc4\x95.com", false, false), // UTF-8 ĕ
   I("xn--jea.com", true, true), // punycode ĕ
-  I("xn--\0xc4\0x95.com", false, false), // UTF-8 ĕ, malformed punycode + UTF-8 mashup
+  I("xn--\xc4\x95.com", false, false), // UTF-8 ĕ, malformed punycode + UTF-8 mashup
 
   // Surprising punycode
   I("xn--google.com", true, true), // 䕮䕵䕶䕱.com
   I("xn--citibank.com", true, true), // 岍岊岊岅岉岎.com
   I("xn--cnn.com", true, true), // 䁾.com
   I("a.xn--cnn", true, true), // a.䁾
   I("a.xn--cnn.com", true, true), // a.䁾.com
 
@@ -493,22 +493,22 @@ static const InputValidity DNSNAMES_VALI
 
 static const InputValidity DNSNAMES_VALIDITY_TURKISH_I[] =
 {
   // http://en.wikipedia.org/wiki/Dotted_and_dotless_I#In_computing
   // IDN registration rules disallow "latin capital letter i with dot above,"
   // but our checks aren't intended to enforce those rules.
   I("I", true, true), // ASCII capital I
   I("i", true, true), // ASCII lowercase i
-  I("\0xC4\0xB0", false, false), // latin capital letter i with dot above
-  I("\0xC4\0xB1", false, false), // latin small letter dotless i
+  I("\xC4\xB0", false, false), // latin capital letter i with dot above
+  I("\xC4\xB1", false, false), // latin small letter dotless i
   I("xn--i-9bb", true, true), // latin capital letter i with dot above, in punycode
   I("xn--cfa", true, true), // latin small letter dotless i, in punycode
-  I("xn--\0xC4\0xB0", false, false), // latin capital letter i with dot above, mashup
-  I("xn--\0xC4\0xB1", false, false), // latin small letter dotless i, mashup
+  I("xn--\xC4\xB0", false, false), // latin capital letter i with dot above, mashup
+  I("xn--\xC4\xB1", false, false), // latin small letter dotless i, mashup
 };
 
 static const uint8_t LOWERCASE_I_VALUE[1] = { 'i' };
 static const uint8_t UPPERCASE_I_VALUE[1] = { 'I' };
 static const Input LOWERCASE_I(LOWERCASE_I_VALUE);
 static const Input UPPERCASE_I(UPPERCASE_I_VALUE);
 
 template <unsigned int L>
@@ -1019,18 +1019,21 @@ static const uint8_t example_com[] = {
   'e', 'x', 'a', 'm', 'p', 'l', 'e', '.', 'c', 'o', 'm'
 };
 
 // Note that We avoid zero-valued bytes in these IP addresses so that we don't
 // get false negatives from anti-NULL-byte defenses in dNSName decoding.
 static const uint8_t ipv4_addr_bytes[] = {
   1, 2, 3, 4
 };
-static const uint8_t ipv4_addr_bytes_as_str[] = "\0x01\x02\0x03\0x04";
+static const uint8_t ipv4_addr_bytes_as_str[] = "\x01\x02\x03\x04";
 static const uint8_t ipv4_addr_str[] = "1.2.3.4";
+static const uint8_t ipv4_addr_bytes_FFFFFFFF[8] = {
+  1, 2, 3, 4, 0xff, 0xff, 0xff, 0xff
+};
 
 static const uint8_t ipv4_compatible_ipv6_addr_bytes[] = {
   0, 0, 0, 0,
   0, 0, 0, 0,
   0, 0, 0, 0,
   1, 2, 3, 4
 };
 static const uint8_t ipv4_compatible_ipv6_addr_str[] = "::1.2.3.4";
@@ -1045,20 +1048,20 @@ static const uint8_t ipv4_mapped_ipv6_ad
 
 static const uint8_t ipv6_addr_bytes[] = {
   0x11, 0x22, 0x33, 0x44,
   0x55, 0x66, 0x77, 0x88,
   0x99, 0xaa, 0xbb, 0xcc,
   0xdd, 0xee, 0xff, 0x11
 };
 static const uint8_t ipv6_addr_bytes_as_str[] =
-  "\0x11\0x22\0x33\0x44"
-  "\0x55\0x66\0x77\0x88"
-  "\0x99\0xaa\0xbb\0xcc"
-  "\0xdd\0xee\0xff\0x11";
+  "\x11\x22\x33\x44"
+  "\x55\x66\x77\x88"
+  "\x99\xaa\xbb\xcc"
+  "\xdd\xee\xff\x11";
 
 static const uint8_t ipv6_addr_str[] =
   "1122:3344:5566:7788:99aa:bbcc:ddee:ff11";
 
 // Note that, for DNSNames, these test cases in CHECK_CERT_HOSTNAME_PARAMS are
 // mostly about testing different scenerios regarding the structure of entries
 // in the subjectAltName and subject of the certificate, than about the how
 // specific presented identifier values are matched against the reference