]> granicus.if.org Git - libexpat/commitdiff
Test more than one colon in an attribute name is rejected
authorRhodri James <rhodri@kynesim.co.uk>
Thu, 15 Jun 2017 15:18:53 +0000 (16:18 +0100)
committerSebastian Pipping <sebastian@pipping.org>
Sat, 22 Jul 2017 20:49:19 +0000 (22:49 +0200)
I.e. test that namespaces don't nest

expat/tests/runtests.c

index b57a942a813d7daee6f0815db58f9759575636f2..c35c89ee22527116995ca0c20f890228fabb3f5e 100644 (file)
@@ -6730,6 +6730,17 @@ START_TEST(test_ns_unknown_encoding_success)
 }
 END_TEST
 
+/* Test that too many colons are rejected */
+START_TEST(test_ns_double_colon)
+{
+    const char *text =
+        "<foo:e xmlns:foo='http://example.org/' foo:a:b='bar' />";
+
+    expect_failure(text, XML_ERROR_INVALID_TOKEN,
+                   "Double colon in attribute name not faulted");
+}
+END_TEST
+
 
 /* Control variable; the number of times duff_allocator() will successfully allocate */
 #define ALLOC_ALWAYS_SUCCEED (-1)
@@ -11444,6 +11455,7 @@ make_suite(void)
     tcase_add_test(tc_namespace, test_ns_reserved_attributes_2);
     tcase_add_test(tc_namespace, test_ns_extremely_long_prefix);
     tcase_add_test(tc_namespace, test_ns_unknown_encoding_success);
+    tcase_add_test(tc_namespace, test_ns_double_colon);
 
     suite_add_tcase(s, tc_misc);
     tcase_add_checked_fixture(tc_misc, NULL, basic_teardown);