expat/tests runtests.c,1.34,1.35

"Fred L. Drake" <[email protected]>
Newsgroups gmane.text.xml.expat.cvs
Message-ID <[email protected]>
Update of /cvsroot/expat/expat/tests
In directory usw-pr-cvs1:/tmp/cvs-serv15835

Modified Files:
	runtests.c 
Log Message:
New test: demonstrate segfault in epilogProcessor().  Karl has a fix
for this that he'll check in shortly.


Index: runtests.c
===================================================================
RCS file: /cvsroot/expat/expat/tests/runtests.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- runtests.c	27 Aug 2002 17:06:19 -0000	1.34
+++ runtests.c	30 Aug 2002 22:05:55 -0000	1.35
@@ -266,6 +266,28 @@
 }
 END_TEST
 
+START_TEST(test_utf16_le_epilog_newline)
+{
+    int first_chunk_bytes = 17;
+    char text[] = 
+        "\xFF\xFE"                      /* BOM */
+        "<\000e\000/\000>\000"          /* document element */
+        "\r\000\n\000\r\000\n\000";     /* epilog */
+
+    if (first_chunk_bytes >= sizeof(text) - 1)
+        fail("bad value of first_chunk_bytes");
+    if (XML_Parse(parser, text, first_chunk_bytes, 0) == XML_STATUS_ERROR)
+        xml_failure(parser);
+    else {
+        enum XML_Status rc;
+        rc = XML_Parse(parser, text + first_chunk_bytes,
+                       sizeof(text) - first_chunk_bytes - 1, 1);
+        if (rc == XML_STATUS_ERROR)
+            xml_failure(parser);
+    }
+}
+END_TEST
+
 /* Regression test for SF bug #481609. */
 START_TEST(test_latin1_umlauts)
 {
@@ -784,6 +806,7 @@
     tcase_add_test(tc_basic, test_bom_utf16_le);
     tcase_add_test(tc_basic, test_illegal_utf8);
     tcase_add_test(tc_basic, test_utf16);
+    tcase_add_test(tc_basic, test_utf16_le_epilog_newline);
     tcase_add_test(tc_basic, test_latin1_umlauts);
     /* Regression test for SF bug #491986. */
     tcase_add_test(tc_basic, test_danish_latin1);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.