Browse Source

[2387] Add unmatched parenthesis testcases that cause lexer failures (when looking for string)

Mukund Sivaraman 12 years ago
parent
commit
4778557e13

+ 3 - 0
src/lib/dns/tests/rdata_dnskey_unittest.cc

@@ -130,6 +130,9 @@ TEST_F(Rdata_DNSKEY_Test, fromText) {
     // parsing from it.
     checkFromText_BadString("257 3 5 YmluZDEwLmlzYy5vcmc= ; comment\n"
                             "257 3 4 YmluZDEwLmlzYy5vcmc=");
+
+    // Unmatched parenthesis should cause a lexer error
+    checkFromText_LexerError("257 3 5 )YmluZDEwLmlzYy5vcmc=");
 }
 
 TEST_F(Rdata_DNSKEY_Test, assign) {

+ 7 - 2
src/lib/dns/tests/rdata_nsec3_unittest.cc

@@ -121,8 +121,9 @@ TEST_F(Rdata_NSEC3_Test, fromText) {
     checkFromText_InvalidText("1 1 65536 D399EAAB "
                               "H9RSFB7FPF2L8HG35CMPC765TDK23RP6 A NS SOA");
 
-    // Space is not allowed in salt (this actually causes the Base32
-    // decoder to throw)
+    // Space is not allowed in salt or the next hash. This actually
+    // causes the Base32 decoder that parses the next hash that comes
+    // afterwards, to throw.
     checkFromText_BadValue("1 1 1 D399 EAAB H9RSFB7FPF2L8"
                            "HG35CMPC765TDK23RP6 A NS SOA");
 
@@ -144,6 +145,10 @@ TEST_F(Rdata_NSEC3_Test, fromText) {
     checkFromText_BadString(
         "1 1 1 D399EAAB H9RSFB7FPF2L8HG35CMPC765TDK23RP6 A NS SOA ;comment\n"
         "1 1 1 D399EAAB H9RSFB7FPF2L8HG35CMPC765TDK23RP6 A NS SOA");
+
+    // Unmatched parenthesis should cause a lexer error
+    checkFromText_LexerError("1 1 1 D399EAAB "
+                             "H9RSFB7FPF2L8HG35CMPC765TDK23RP6 A ) NS SOA");
 }
 
 TEST_F(Rdata_NSEC3_Test, createFromWire) {