From 36d8911ecb490e7eb90c68ba34c2b9a9a821612c Mon Sep 17 00:00:00 2001 From: Rhodri James Date: Fri, 9 Jun 2017 15:23:38 +0100 Subject: [PATCH] Test ASCII-like unknown encoding correctly rejects invalid characters --- expat/tests/runtests.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/expat/tests/runtests.c b/expat/tests/runtests.c index 33c6df3a..53b4b19c 100644 --- a/expat/tests/runtests.c +++ b/expat/tests/runtests.c @@ -5511,6 +5511,18 @@ START_TEST(test_unknown_ascii_encoding_ok) } END_TEST +START_TEST(test_unknown_ascii_encoding_fail) +{ + const char *text = + "\n" + "Hello, \x80 world"; + + XML_SetUnknownEncodingHandler(parser, AsciiAsUnknownEncodingHandler, NULL); + expect_failure(text, XML_ERROR_INVALID_TOKEN, + "Invalid character not faulted"); +} +END_TEST + /* * Namespaces tests. @@ -10777,6 +10789,7 @@ make_suite(void) tcase_add_test(tc_basic, test_unknown_encoding_long_name_2); tcase_add_test(tc_basic, test_invalid_unknown_encoding); tcase_add_test(tc_basic, test_unknown_ascii_encoding_ok); + tcase_add_test(tc_basic, test_unknown_ascii_encoding_fail); suite_add_tcase(s, tc_namespace); tcase_add_checked_fixture(tc_namespace, -- 2.40.0