Imported Upstream version 2.9.5_rc2 69/156069/1
authorDongHun Kwak <dh0128.kwak@samsung.com>
Tue, 17 Oct 2017 05:41:39 +0000 (14:41 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Tue, 17 Oct 2017 05:41:42 +0000 (14:41 +0900)
Change-Id: I1713fddeb3c21d510a0194abdf5d37d5674780c2
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
18 files changed:
include/libxml/xmlversion.h
libxml.spec.in
libxml2.spec
parser.c
parserInternals.c
result/errors/partial_utf8_1.xml [deleted file]
result/errors/partial_utf8_1.xml.err [deleted file]
result/errors/partial_utf8_1.xml.str [deleted file]
result/errors/partial_utf8_2.xml [deleted file]
result/errors/partial_utf8_2.xml.err [deleted file]
result/errors/partial_utf8_2.xml.str [deleted file]
result/errors/partial_utf8_3.xml [deleted file]
result/errors/partial_utf8_3.xml.err [deleted file]
result/errors/partial_utf8_3.xml.str [deleted file]
test/errors/partial_utf8_1.xml [deleted file]
test/errors/partial_utf8_2.xml [deleted file]
test/errors/partial_utf8_3.xml [deleted file]
testapi.c

index 094d5bd..59c6c5a 100644 (file)
@@ -50,7 +50,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
  *
  * extra version information, used to show a CVS compilation
  */
-#define LIBXML_VERSION_EXTRA "-GITv2.9.4-110-ge29e50e"
+#define LIBXML_VERSION_EXTRA "-GITv2.9.5-rc1-1-g69936b1"
 
 /**
  * LIBXML_TEST_VERSION:
index bdb644d..e676edd 100644 (file)
@@ -3,10 +3,10 @@
 Summary: Library providing XML and HTML support
 Name: libxml2
 Version: @VERSION@
-Release: 0rc1%{?dist}%{?extra_release}
+Release: 0rc2%{?dist}%{?extra_release}
 License: MIT
 Group: Development/Libraries
-Source: ftp://xmlsoft.org/libxml2/libxml2-%{version}-rc1.tar.gz
+Source: ftp://xmlsoft.org/libxml2/libxml2-%{version}-rc2.tar.gz
 BuildRoot: %{_tmppath}/%{name}-%{version}-root
 BuildRequires: python-devel
 %if 0%{?with_python3}
index 7fa7cfb..ec02daf 100644 (file)
@@ -3,10 +3,10 @@
 Summary: Library providing XML and HTML support
 Name: libxml2
 Version: 2.9.5
-Release: 0rc1%{?dist}%{?extra_release}
+Release: 0rc2%{?dist}%{?extra_release}
 License: MIT
 Group: Development/Libraries
-Source: ftp://xmlsoft.org/libxml2/libxml2-%{version}-rc1.tar.gz
+Source: ftp://xmlsoft.org/libxml2/libxml2-%{version}-rc2.tar.gz
 BuildRoot: %{_tmppath}/%{name}-%{version}-root
 BuildRequires: python-devel
 %if 0%{?with_python3}
@@ -203,6 +203,6 @@ rm -fr %{buildroot}
 %endif # with_python3
 
 %changelog
-* Tue Aug 29 2017 Daniel Veillard <veillard@redhat.com>
+* Thu Aug 31 2017 Daniel Veillard <veillard@redhat.com>
 - upstream release 2.9.5 see http://xmlsoft.org/news.html
 
index 9a7135f..1005395 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -4586,7 +4586,7 @@ xmlParseCharDataComplex(xmlParserCtxtPtr ctxt, int cdata) {
            }
        }
     }
-    if ((ctxt->input->cur < ctxt->input->end) && (!IS_CHAR(cur))) {
+    if ((cur != 0) && (!IS_CHAR(cur))) {
        /* Generate the error and skip the offending character */
         xmlFatalErrMsgInt(ctxt, XML_ERR_INVALID_CHAR,
                           "PCDATA invalid Char value %d\n",
index 81b0e0f..43a0f5a 100644 (file)
@@ -701,6 +701,16 @@ xmlCurrentChar(xmlParserCtxtPtr ctxt, int *len) {
     return((int) *ctxt->input->cur);
 encoding_error:
     /*
+     * An encoding problem may arise from a truncated input buffer
+     * splitting a character in the middle. In that case do not raise
+     * an error but return 0 to endicate an end of stream problem
+     */
+    if (ctxt->input->end - ctxt->input->cur < 4) {
+       *len = 0;
+       return(0);
+    }
+
+    /*
      * If we detect an UTF8 error that probably mean that the
      * input encoding didn't get properly advertised in the
      * declaration header. Report the error and switch the encoding
@@ -710,21 +720,9 @@ encoding_error:
     {
         char buffer[150];
 
-        if (ctxt->input->cur[1] == 0) {
-            snprintf(&buffer[0], 149, "Bytes: 0x%02X EOF\n",
-                     ctxt->input->cur[0]);
-        } else if (ctxt->input->cur[2] == 0) {
-            snprintf(&buffer[0], 149, "Bytes: 0x%02X 0x%02X EOF\n",
-                     ctxt->input->cur[0], ctxt->input->cur[1]);
-        } else if (ctxt->input->cur[3] == 0) {
-            snprintf(&buffer[0], 149, "Bytes: 0x%02X 0x%02X 0x%02X EOF\n",
-                     ctxt->input->cur[0], ctxt->input->cur[1],
-                     ctxt->input->cur[2]);
-        } else {
-           snprintf(&buffer[0], 149, "Bytes: 0x%02X 0x%02X 0x%02X 0x%02X\n",
-                    ctxt->input->cur[0], ctxt->input->cur[1],
-                    ctxt->input->cur[2], ctxt->input->cur[3]);
-        }
+       snprintf(&buffer[0], 149, "Bytes: 0x%02X 0x%02X 0x%02X 0x%02X\n",
+                       ctxt->input->cur[0], ctxt->input->cur[1],
+                       ctxt->input->cur[2], ctxt->input->cur[3]);
        __xmlErrEncoding(ctxt, XML_ERR_INVALID_CHAR,
                     "Input is not proper UTF-8, indicate encoding !\n%s",
                     BAD_CAST buffer, NULL);
@@ -814,6 +812,17 @@ xmlStringCurrentChar(xmlParserCtxtPtr ctxt, const xmlChar * cur, int *len)
     *len = 1;
     return ((int) *cur);
 encoding_error:
+
+    /*
+     * An encoding problem may arise from a truncated input buffer
+     * splitting a character in the middle. In that case do not raise
+     * an error but return 0 to endicate an end of stream problem
+     */
+    if ((ctxt == NULL) || (ctxt->input == NULL) ||
+        (ctxt->input->end - ctxt->input->cur < 4)) {
+       *len = 0;
+       return(0);
+    }
     /*
      * If we detect an UTF8 error that probably mean that the
      * input encoding didn't get properly advertised in the
@@ -824,19 +833,9 @@ encoding_error:
     {
         char buffer[150];
 
-        if (cur[1] == 0) {
-            snprintf(&buffer[0], 149, "Bytes: 0x%02X EOF\n",
-                     cur[0]);
-        } else if (cur[2] == 0) {
-            snprintf(&buffer[0], 149, "Bytes: 0x%02X 0x%02X EOF\n",
-                     cur[0], cur[1]);
-        } else if (cur[3] == 0) {
-            snprintf(&buffer[0], 149, "Bytes: 0x%02X 0x%02X 0x%02X EOF\n",
-                     cur[0], cur[1], cur[2]);
-        } else {
-           snprintf(&buffer[0], 149, "Bytes: 0x%02X 0x%02X 0x%02X 0x%02X\n",
-                    cur[0], cur[1], cur[2], cur[3]);
-        }
+       snprintf(buffer, 149, "Bytes: 0x%02X 0x%02X 0x%02X 0x%02X\n",
+                       ctxt->input->cur[0], ctxt->input->cur[1],
+                       ctxt->input->cur[2], ctxt->input->cur[3]);
        __xmlErrEncoding(ctxt, XML_ERR_INVALID_CHAR,
                     "Input is not proper UTF-8, indicate encoding !\n%s",
                     BAD_CAST buffer, NULL);
diff --git a/result/errors/partial_utf8_1.xml b/result/errors/partial_utf8_1.xml
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/result/errors/partial_utf8_1.xml.err b/result/errors/partial_utf8_1.xml.err
deleted file mode 100644 (file)
index 544594f..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-./test/errors/partial_utf8_1.xml:1: parser error : Input is not proper UTF-8, indicate encoding !
-Bytes: 0xC2 EOF
-<a>Â
-   ^
-./test/errors/partial_utf8_1.xml:1: parser error : Premature end of data in tag a line 1
-<a>Â
-    ^
diff --git a/result/errors/partial_utf8_1.xml.str b/result/errors/partial_utf8_1.xml.str
deleted file mode 100644 (file)
index 8b0cb57..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-./test/errors/partial_utf8_1.xml:1: parser error : Extra content at the end of the document
-<a>Â
-   ^
-./test/errors/partial_utf8_1.xml : failed to parse
diff --git a/result/errors/partial_utf8_2.xml b/result/errors/partial_utf8_2.xml
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/result/errors/partial_utf8_2.xml.err b/result/errors/partial_utf8_2.xml.err
deleted file mode 100644 (file)
index b205821..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-./test/errors/partial_utf8_2.xml:1: parser error : Input is not proper UTF-8, indicate encoding !
-Bytes: 0xE3 0xA0 EOF
-<a>ã 
-   ^
-./test/errors/partial_utf8_2.xml:1: parser error : Premature end of data in tag a line 1
-<a>ã 
-     ^
diff --git a/result/errors/partial_utf8_2.xml.str b/result/errors/partial_utf8_2.xml.str
deleted file mode 100644 (file)
index a91e904..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-./test/errors/partial_utf8_2.xml:1: parser error : Input is not proper UTF-8, indicate encoding !
-Bytes: 0xE3 0xA0 EOF
-<a>ã 
-   ^
-./test/errors/partial_utf8_2.xml : failed to parse
diff --git a/result/errors/partial_utf8_3.xml b/result/errors/partial_utf8_3.xml
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/result/errors/partial_utf8_3.xml.err b/result/errors/partial_utf8_3.xml.err
deleted file mode 100644 (file)
index 111ac11..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-./test/errors/partial_utf8_3.xml:1: parser error : Input is not proper UTF-8, indicate encoding !
-Bytes: 0xF2 0xA0 0xA0 EOF
-<a>ò  
-   ^
-./test/errors/partial_utf8_3.xml:1: parser error : Premature end of data in tag a line 1
-<a>ò  
-      ^
diff --git a/result/errors/partial_utf8_3.xml.str b/result/errors/partial_utf8_3.xml.str
deleted file mode 100644 (file)
index 2060852..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-./test/errors/partial_utf8_3.xml:1: parser error : Input is not proper UTF-8, indicate encoding !
-Bytes: 0xF2 0xA0 0xA0 EOF
-<a>ò  
-   ^
-./test/errors/partial_utf8_3.xml : failed to parse
diff --git a/test/errors/partial_utf8_1.xml b/test/errors/partial_utf8_1.xml
deleted file mode 100644 (file)
index f859620..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<a>Â
\ No newline at end of file
diff --git a/test/errors/partial_utf8_2.xml b/test/errors/partial_utf8_2.xml
deleted file mode 100644 (file)
index dbc2d81..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<a>ã 
\ No newline at end of file
diff --git a/test/errors/partial_utf8_3.xml b/test/errors/partial_utf8_3.xml
deleted file mode 100644 (file)
index 0abd9de..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<a>ò  
\ No newline at end of file
index 168ceb6..b2f6e46 100644 (file)
--- a/testapi.c
+++ b/testapi.c
@@ -2333,16 +2333,16 @@ test_htmlParseDoc(void) {
     char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
     int n_encoding;
 
-    for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
+    for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
         mem_base = xmlMemBlocks();
-        cur = gen_const_xmlChar_ptr(n_cur, 0);
+        cur = gen_xmlChar_ptr(n_cur, 0);
         encoding = gen_const_char_ptr(n_encoding, 1);
 
-        ret_val = htmlParseDoc((const xmlChar *)cur, (const char *)encoding);
+        ret_val = htmlParseDoc(cur, (const char *)encoding);
         desret_htmlDocPtr(ret_val);
         call_tests++;
-        des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
+        des_xmlChar_ptr(n_cur, cur, 0);
         des_const_char_ptr(n_encoding, (const char *)encoding, 1);
         xmlResetLastError();
         if (mem_base != xmlMemBlocks()) {
@@ -2685,20 +2685,20 @@ test_htmlSAXParseDoc(void) {
     void * userData; /* if using SAX, this pointer will be provided on callbacks. */
     int n_userData;
 
-    for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
+    for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
     for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
     for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) {
         mem_base = xmlMemBlocks();
-        cur = gen_const_xmlChar_ptr(n_cur, 0);
+        cur = gen_xmlChar_ptr(n_cur, 0);
         encoding = gen_const_char_ptr(n_encoding, 1);
         sax = gen_htmlSAXHandlerPtr(n_sax, 2);
         userData = gen_userdata(n_userData, 3);
 
-        ret_val = htmlSAXParseDoc((const xmlChar *)cur, (const char *)encoding, sax, userData);
+        ret_val = htmlSAXParseDoc(cur, (const char *)encoding, sax, userData);
         desret_htmlDocPtr(ret_val);
         call_tests++;
-        des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
+        des_xmlChar_ptr(n_cur, cur, 0);
         des_const_char_ptr(n_encoding, (const char *)encoding, 1);
         des_htmlSAXHandlerPtr(n_sax, sax, 2);
         des_userdata(n_userData, userData, 3);