From cdf8c0a11b8c74a997f4b0598415ac1ca3565c53 Mon Sep 17 00:00:00 2001 From: Oleg Korshul Date: Fri, 14 Apr 2017 19:03:02 +0300 Subject: [PATCH] update libxml (for sec) --- DesktopEditor/xml/build/qt/libxml2_all.c | 4 +- DesktopEditor/xml/libxml2/ChangeLog | 26 +- DesktopEditor/xml/libxml2/DOCBparser.c | 2 +- DesktopEditor/xml/libxml2/HTMLparser.c | 170 +- DesktopEditor/xml/libxml2/HTMLtree.c | 3 +- DesktopEditor/xml/libxml2/Makefile.am | 10 +- DesktopEditor/xml/libxml2/NEWS | 682 ++++++- DesktopEditor/xml/libxml2/SAX2.c | 31 +- DesktopEditor/xml/libxml2/TODO | 2 +- DesktopEditor/xml/libxml2/buf.c | 47 +- DesktopEditor/xml/libxml2/buf.h | 6 +- DesktopEditor/xml/libxml2/catalog.c | 21 +- DesktopEditor/xml/libxml2/configure.in | 1599 ----------------- DesktopEditor/xml/libxml2/debugXML.c | 21 +- DesktopEditor/xml/libxml2/dict.c | 55 +- DesktopEditor/xml/libxml2/doc/APIchunk1.html | 2 +- DesktopEditor/xml/libxml2/doc/APIchunk11.html | 4 +- DesktopEditor/xml/libxml2/doc/APIchunk12.html | 5 +- DesktopEditor/xml/libxml2/doc/APIchunk13.html | 28 - DesktopEditor/xml/libxml2/doc/APIchunk14.html | 2 - DesktopEditor/xml/libxml2/doc/APIchunk17.html | 2 +- DesktopEditor/xml/libxml2/doc/APIchunk26.html | 3 +- DesktopEditor/xml/libxml2/doc/APIchunk28.html | 4 +- DesktopEditor/xml/libxml2/doc/APIchunk29.html | 2 +- DesktopEditor/xml/libxml2/doc/APIchunk5.html | 2 +- DesktopEditor/xml/libxml2/doc/APIfiles.html | 3 +- .../xml/libxml2/doc/APIfunctions.html | 86 +- DesktopEditor/xml/libxml2/doc/APIsymbols.html | 3 +- DesktopEditor/xml/libxml2/doc/apibuild.py | 1 + .../xml/libxml2/doc/devhelp/general.html | 2 +- .../xml/libxml2/doc/devhelp/libxml2-dict.html | 32 +- .../libxml2/doc/devhelp/libxml2-entities.html | 8 +- .../libxml2/doc/devhelp/libxml2-parser.html | 8 +- .../xml/libxml2/doc/devhelp/libxml2-tree.html | 151 +- .../libxml2/doc/devhelp/libxml2-xmlerror.html | 2 +- .../doc/devhelp/libxml2-xmlmemory.html | 2 +- .../doc/devhelp/libxml2-xmlregexp.html | 2 +- .../doc/devhelp/libxml2-xmlschemastypes.html | 4 +- .../doc/devhelp/libxml2-xmlstring.html | 8 +- .../xml/libxml2/doc/devhelp/libxml2.devhelp | 3 +- DesktopEditor/xml/libxml2/doc/docdescr.doc | 2 +- .../xml/libxml2/doc/examples/examples.xml | 6 +- .../xml/libxml2/doc/examples/index.html | 2 +- .../xml/libxml2/doc/examples/io1.res | 2 +- .../xml/libxml2/doc/examples/parse4.c | 6 +- .../xml/libxml2/doc/examples/tree2.c | 3 +- DesktopEditor/xml/libxml2/doc/html/book1.html | 2 +- DesktopEditor/xml/libxml2/doc/html/index.html | 2 +- .../xml/libxml2/doc/html/libxml-dict.html | 28 +- .../xml/libxml2/doc/html/libxml-entities.html | 8 +- .../xml/libxml2/doc/html/libxml-lib.html | 2 +- .../xml/libxml2/doc/html/libxml-parser.html | 8 +- .../xml/libxml2/doc/html/libxml-tree.html | 147 +- .../xml/libxml2/doc/html/libxml-xmlerror.html | 2 +- .../libxml2/doc/html/libxml-xmlmemory.html | 2 +- .../libxml2/doc/html/libxml-xmlregexp.html | 2 +- .../doc/html/libxml-xmlschemastypes.html | 4 +- .../libxml2/doc/html/libxml-xmlstring.html | 8 +- DesktopEditor/xml/libxml2/doc/index.py | 6 +- DesktopEditor/xml/libxml2/doc/interface.html | 2 +- DesktopEditor/xml/libxml2/doc/library.html | 6 +- DesktopEditor/xml/libxml2/doc/libxml2-api.xml | 162 +- .../xml/libxml2/doc/libxml2-refs.xml | 161 +- DesktopEditor/xml/libxml2/doc/libxml2.xsa | 183 +- DesktopEditor/xml/libxml2/doc/news.html | 353 +++- DesktopEditor/xml/libxml2/doc/search.php | 5 +- DesktopEditor/xml/libxml2/doc/symbols.xml | 2 +- DesktopEditor/xml/libxml2/doc/xml.html | 366 +++- DesktopEditor/xml/libxml2/doc/xmllint.1 | 7 +- DesktopEditor/xml/libxml2/doc/xmllint.xml | 2 +- DesktopEditor/xml/libxml2/elfgcchack.h | 54 +- DesktopEditor/xml/libxml2/enc.h | 2 +- DesktopEditor/xml/libxml2/encoding.c | 2 +- DesktopEditor/xml/libxml2/entities.c | 6 +- DesktopEditor/xml/libxml2/error.c | 6 +- DesktopEditor/xml/libxml2/gentest.py | 2 +- DesktopEditor/xml/libxml2/hash.c | 3 + .../xml/libxml2/include/libxml/DOCBparser.h | 2 +- .../xml/libxml2/include/libxml/HTMLparser.h | 2 +- .../xml/libxml2/include/libxml/HTMLtree.h | 2 +- .../xml/libxml2/include/libxml/SAX.h | 2 +- .../xml/libxml2/include/libxml/SAX2.h | 8 +- .../xml/libxml2/include/libxml/c14n.h | 2 +- .../xml/libxml2/include/libxml/catalog.h | 2 +- .../xml/libxml2/include/libxml/chvalid.h | 2 +- .../xml/libxml2/include/libxml/debugXML.h | 2 +- .../xml/libxml2/include/libxml/dict.h | 24 +- .../xml/libxml2/include/libxml/encoding.h | 2 +- .../xml/libxml2/include/libxml/entities.h | 6 +- .../xml/libxml2/include/libxml/globals.h | 19 +- .../xml/libxml2/include/libxml/hash.h | 2 +- .../xml/libxml2/include/libxml/list.h | 2 +- .../xml/libxml2/include/libxml/nanoftp.h | 2 +- .../xml/libxml2/include/libxml/nanohttp.h | 2 +- .../xml/libxml2/include/libxml/parser.h | 11 +- .../libxml2/include/libxml/parserInternals.h | 4 +- .../xml/libxml2/include/libxml/pattern.h | 2 +- .../xml/libxml2/include/libxml/relaxng.h | 10 +- .../libxml2/include/libxml/schemasInternals.h | 94 +- .../xml/libxml2/include/libxml/schematron.h | 2 +- .../xml/libxml2/include/libxml/threads.h | 2 +- .../xml/libxml2/include/libxml/tree.h | 96 +- .../xml/libxml2/include/libxml/uri.h | 2 +- .../xml/libxml2/include/libxml/valid.h | 2 +- .../xml/libxml2/include/libxml/xinclude.h | 2 +- .../xml/libxml2/include/libxml/xlink.h | 2 +- .../xml/libxml2/include/libxml/xmlIO.h | 12 +- .../xml/libxml2/include/libxml/xmlautomata.h | 2 +- .../xml/libxml2/include/libxml/xmlerror.h | 7 +- .../xml/libxml2/include/libxml/xmlexports.h | 2 +- .../xml/libxml2/include/libxml/xmlmemory.h | 2 +- .../xml/libxml2/include/libxml/xmlmodule.h | 2 +- .../xml/libxml2/include/libxml/xmlreader.h | 2 +- .../xml/libxml2/include/libxml/xmlregexp.h | 2 +- .../xml/libxml2/include/libxml/xmlsave.h | 2 +- .../xml/libxml2/include/libxml/xmlschemas.h | 2 +- .../libxml2/include/libxml/xmlschemastypes.h | 2 +- .../xml/libxml2/include/libxml/xmlstring.h | 10 +- .../xml/libxml2/include/libxml/xmlunicode.h | 2 +- .../xml/libxml2/include/libxml/xmlversion.h | 4 +- .../libxml2/include/libxml/xmlwin32version.h | 2 +- .../xml/libxml2/include/libxml/xmlwriter.h | 2 +- .../xml/libxml2/include/libxml/xpath.h | 2 +- .../libxml2/include/libxml/xpathInternals.h | 4 +- .../xml/libxml2/include/libxml/xpointer.h | 2 +- .../xml/libxml2/include/win32config.h | 6 +- .../xml/libxml2/include/wsockcompat.h | 2 +- DesktopEditor/xml/libxml2/legacy.c | 2 +- DesktopEditor/xml/libxml2/libxml.h | 30 +- DesktopEditor/xml/libxml2/libxml.spec.in | 61 +- DesktopEditor/xml/libxml2/libxml2.syms | 2 +- .../xml/libxml2/macos/src/XMLTestPrefix.h | 2 +- .../xml/libxml2/macos/src/XMLTestPrefix2.h | 2 +- .../xml/libxml2/macos/src/config-mac.h | 2 +- DesktopEditor/xml/libxml2/nanoftp.c | 46 +- DesktopEditor/xml/libxml2/nanohttp.c | 20 +- DesktopEditor/xml/libxml2/optim/hash_dict.txt | 2 +- DesktopEditor/xml/libxml2/parser.c | 470 +++-- DesktopEditor/xml/libxml2/parserInternals.c | 205 ++- .../xml/libxml2/python/drv_libxml2.py | 18 +- DesktopEditor/xml/libxml2/python/generator.py | 4 +- DesktopEditor/xml/libxml2/python/libxml.c | 2 +- DesktopEditor/xml/libxml2/python/libxml.py | 6 +- .../xml/libxml2/python/libxml_wrap.h | 2 +- DesktopEditor/xml/libxml2/python/setup.py | 2 +- DesktopEditor/xml/libxml2/python/setup.py.in | 86 +- .../xml/libxml2/python/tests/sync.py | 29 +- DesktopEditor/xml/libxml2/relaxng.c | 40 +- .../xml/libxml2/result/XPath/expr/base | 8 + .../libxml2/result/XPath/tests/chaptersbase | 10 + .../xml/libxml2/result/XPath/tests/simplebase | 54 + .../xml/libxml2/result/XPath/xptr/vidbase | 13 + .../xml/libxml2/result/errors/cdata.xml.str | 4 +- .../libxml2/result/errors/content1.xml.err | 2 +- .../xml/libxml2/result/valid/t8.xml.err | 2 +- .../xml/libxml2/result/valid/t8a.xml.err | 2 +- DesktopEditor/xml/libxml2/rngparser.c | 2 +- DesktopEditor/xml/libxml2/runtest.c | 115 +- DesktopEditor/xml/libxml2/save.h | 2 +- DesktopEditor/xml/libxml2/schematron.c | 8 +- .../xml/libxml2/test/XPath/expr/base | 2 + .../xml/libxml2/test/XPath/tests/chaptersbase | 1 + .../xml/libxml2/test/XPath/tests/simplebase | 6 + .../xml/libxml2/test/XPath/xptr/vidbase | 1 + DesktopEditor/xml/libxml2/testModule.c | 2 +- DesktopEditor/xml/libxml2/testOOMlib.h | 2 +- DesktopEditor/xml/libxml2/testSAX.c | 8 +- DesktopEditor/xml/libxml2/testapi.c | 483 ++--- DesktopEditor/xml/libxml2/testdict.c | 4 +- DesktopEditor/xml/libxml2/testlimits.c | 12 +- DesktopEditor/xml/libxml2/threads.c | 10 +- DesktopEditor/xml/libxml2/timsort.h | 93 +- DesktopEditor/xml/libxml2/tree.c | 163 +- DesktopEditor/xml/libxml2/trio.c | 138 +- DesktopEditor/xml/libxml2/trio.h | 16 +- DesktopEditor/xml/libxml2/triodef.h | 8 +- DesktopEditor/xml/libxml2/trionan.h | 2 +- DesktopEditor/xml/libxml2/triop.h | 2 +- DesktopEditor/xml/libxml2/triostr.c | 8 +- DesktopEditor/xml/libxml2/triostr.h | 2 +- DesktopEditor/xml/libxml2/uri.c | 47 +- DesktopEditor/xml/libxml2/valid.c | 21 +- .../xml/libxml2/vms/build_libxml.com | 17 +- DesktopEditor/xml/libxml2/vms/config.vms | 7 + DesktopEditor/xml/libxml2/win32/Makefile.msvc | 2 +- DesktopEditor/xml/libxml2/win32/VC10/config.h | 4 +- .../xml/libxml2/win32/VC10/libxml2.sdf | Bin 327680 -> 0 bytes .../xml/libxml2/win32/VC10/libxml2.v12.suo | Bin 20992 -> 0 bytes .../xml/libxml2/win32/VC10/libxml2.vcxproj | 4 +- .../win32/VC10/libxml2.vcxproj.filters | 3 - .../xml/libxml2/win32/VC10/runsuite.vcxproj | 4 +- DesktopEditor/xml/libxml2/win32/configure.js | 2 +- .../xml/libxml2/win32/libxml2.def.src | 26 +- .../xml/libxml2/win32/wince/wincecompat.h | 2 +- DesktopEditor/xml/libxml2/xinclude.c | 7 +- DesktopEditor/xml/libxml2/xmlIO.c | 100 +- DesktopEditor/xml/libxml2/xmlcatalog.c | 12 +- DesktopEditor/xml/libxml2/xmllint.c | 47 +- DesktopEditor/xml/libxml2/xmlmemory.c | 45 +- DesktopEditor/xml/libxml2/xmlmodule.c | 4 +- DesktopEditor/xml/libxml2/xmlreader.c | 142 +- DesktopEditor/xml/libxml2/xmlregexp.c | 22 +- DesktopEditor/xml/libxml2/xmlsave.c | 8 +- DesktopEditor/xml/libxml2/xmlschemas.c | 152 +- DesktopEditor/xml/libxml2/xmlschemastypes.c | 32 +- DesktopEditor/xml/libxml2/xmlstring.c | 70 +- DesktopEditor/xml/libxml2/xmlwriter.c | 30 +- DesktopEditor/xml/libxml2/xpath.c | 113 +- DesktopEditor/xml/libxml2/xpointer.c | 277 ++- DesktopEditor/xml/libxml2/xzlib.c | 10 +- DesktopEditor/xml/libxml2/xzlib.h | 2 +- 211 files changed, 4584 insertions(+), 3845 deletions(-) delete mode 100644 DesktopEditor/xml/libxml2/configure.in delete mode 100644 DesktopEditor/xml/libxml2/win32/VC10/libxml2.sdf delete mode 100644 DesktopEditor/xml/libxml2/win32/VC10/libxml2.v12.suo diff --git a/DesktopEditor/xml/build/qt/libxml2_all.c b/DesktopEditor/xml/build/qt/libxml2_all.c index 4449cefbe7..f9c3cc1c99 100644 --- a/DesktopEditor/xml/build/qt/libxml2_all.c +++ b/DesktopEditor/xml/build/qt/libxml2_all.c @@ -9,6 +9,7 @@ #include "../../libxml2/entities.c" #include "../../libxml2/error.c" #include "../../libxml2/globals.c" +#include "../../libxml2/hash.c" #include "../../libxml2/HTMLparser.c" #include "../../libxml2/HTMLtree.c" #include "../../libxml2/legacy.c" @@ -16,6 +17,7 @@ #include "../../libxml2/nanoftp.c" #include "../../libxml2/nanohttp.c" //#include "../../libxml2/parser.c" +#include "../../libxml2/parserInternals.c" #include "../../libxml2/pattern.c" #include "../../libxml2/relaxng.c" #include "../../libxml2/SAX.c" @@ -40,5 +42,3 @@ #include "../../libxml2/xmlwriter.c" #include "../../libxml2/xpath.c" #include "../../libxml2/xpointer.c" -#include "../../libxml2/parserInternals.c" -#include "../../libxml2/hash.c" diff --git a/DesktopEditor/xml/libxml2/ChangeLog b/DesktopEditor/xml/libxml2/ChangeLog index 8f3848aa4b..a6b76bb860 100644 --- a/DesktopEditor/xml/libxml2/ChangeLog +++ b/DesktopEditor/xml/libxml2/ChangeLog @@ -593,7 +593,7 @@ Thu Apr 24 13:56:53 CEST 2008 Daniel Veillard Tue Apr 22 10:27:17 CEST 2008 Daniel Veillard - * dict.c: improvement on the hashing of the dictionnary, with visible + * dict.c: improvement on the hashing of the dictionary, with visible speed up as the number of strings in the hash increases, work from Stefan Behnel @@ -2479,7 +2479,7 @@ Mon Jan 9 17:27:15 CET 2006 Kasimier Buchcik Mon Jan 9 15:33:16 CET 2006 Daniel Veillard * parser.c: reverted first patches for #319279 which led to #326295 - and fixed the problem in DoctRenderer() instead + and fixed the problem in xmlParseChunk() instead * test/ent11 result//ent11*: added test for #326295 to the regression suite @@ -5017,7 +5017,7 @@ Mon Jan 24 00:47:41 CET 2005 Daniel Veillard Sun Jan 23 23:54:39 CET 2005 Daniel Veillard * hash.c include/libxml/hash.h: added xmlHashCreateDict where - the hash reuses the dictionnary for internal strings + the hash reuses the dictionary for internal strings * entities.c valid.c parser.c: reuse that new API, leads to a decent speedup when parsing for example DocBook documents. @@ -5371,7 +5371,7 @@ Fri Nov 26 11:44:36 CET 2004 Daniel Veillard Wed Nov 24 13:41:52 CET 2004 Daniel Veillard * dict.c include/libxml/dict.h: added xmlDictExists() to the - dictionnary interface. + dictionary interface. * xmlreader.c: applying xmlTextReaderHasAttributes fix for namespaces from Rob Richards @@ -5697,7 +5697,7 @@ Tue Oct 26 23:57:02 CEST 2004 Daniel Veillard Tue Oct 26 18:09:59 CEST 2004 Daniel Veillard * debugXML.c include/libxml/xmlerror.h: added checking for names - values and dictionnaries generates a tons of errors + values and dictionaries generates a tons of errors * SAX2.ccatalog.c parser.c relaxng.c tree.c xinclude.c xmlwriter.c include/libxml/tree.h: fixing the errors in the regression tests @@ -7746,14 +7746,14 @@ Fri Jan 23 14:03:21 CET 2004 Daniel Veillard make tests * xpath.c include/libxml/xpath.h: added xmlXPathCtxtCompile() to compile an XPath expression within a context, currently the goal - is to be able to reuse the XSLT stylesheet dictionnary, but this + is to be able to reuse the XSLT stylesheet dictionary, but this opens the door to others possible optimizations. * dict.c include/libxml/dict.h: added xmlDictCreateSub() which allows - to build a new dictionnary based on another read-only dictionnary. - This is needed for XSLT to keep the stylesheet dictionnary read-only + to build a new dictionary based on another read-only dictionary. + This is needed for XSLT to keep the stylesheet dictionary read-only while being able to reuse the strings for the transformation - dictionnary. - * xinclude.c: fixed a dictionnar reference counting problem occuring + dictionary. + * xinclude.c: fixed a dictionary reference counting problem occuring when document parsing failed. * testSAX.c: adding option --repeat for timing 100times the parsing * doc/* : rebuilt all the docs @@ -7806,7 +7806,7 @@ Mon Jan 12 17:22:57 CET 2004 Daniel Veillard Thu Jan 8 17:57:50 CET 2004 Daniel Veillard * xmlschemas.c: removed a memory leak remaining from the switch - to a dictionnary for string allocations c.f. #130891 + to a dictionary for string allocations c.f. #130891 Thu Jan 8 17:48:46 CET 2004 Daniel Veillard @@ -7928,7 +7928,7 @@ Fri Jan 2 22:58:29 HKT 2004 William Brack Fri Jan 2 11:40:06 CET 2004 Daniel Veillard * SAX2.c: found and fixed a bug misallocating some non - blank text node strings from the dictionnary. + blank text node strings from the dictionary. * xmlmemory.c: fixed a problem with the memory debug mutex release. @@ -9386,7 +9386,7 @@ Sat Sep 27 01:25:39 CEST 2003 Daniel Veillard * parser.c: William's change allowed to spot a nasty bug in xmlDoRead if the result is not well formed that ctxt->myDoc is not NULL - and uses the context dictionnary. + and uses the context dictionary. Fri Sep 26 21:09:34 CEST 2003 Daniel Veillard diff --git a/DesktopEditor/xml/libxml2/DOCBparser.c b/DesktopEditor/xml/libxml2/DOCBparser.c index a3c823c4b2..14f9b75780 100644 --- a/DesktopEditor/xml/libxml2/DOCBparser.c +++ b/DesktopEditor/xml/libxml2/DOCBparser.c @@ -120,7 +120,7 @@ docbParseChunk(docbParserCtxtPtr ctxt ATTRIBUTE_UNUSED, deprecated = 1; } - return (DoctRenderer(ctxt, chunk, size, terminate)); + return (xmlParseChunk(ctxt, chunk, size, terminate)); } /** diff --git a/DesktopEditor/xml/libxml2/HTMLparser.c b/DesktopEditor/xml/libxml2/HTMLparser.c index 2b5d1a4b88..55c5c776db 100644 --- a/DesktopEditor/xml/libxml2/HTMLparser.c +++ b/DesktopEditor/xml/libxml2/HTMLparser.c @@ -105,7 +105,7 @@ htmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra) * * Handle a fatal parser error, i.e. violating Well-Formedness constraints */ -static void +static void LIBXML_ATTR_FORMAT(3,0) htmlParseErr(xmlParserCtxtPtr ctxt, xmlParserErrors error, const char *msg, const xmlChar *str1, const xmlChar *str2) { @@ -132,7 +132,7 @@ htmlParseErr(xmlParserCtxtPtr ctxt, xmlParserErrors error, * * Handle a fatal parser error, i.e. violating Well-Formedness constraints */ -static void +static void LIBXML_ATTR_FORMAT(3,0) htmlParseErrInt(xmlParserCtxtPtr ctxt, xmlParserErrors error, const char *msg, int val) { @@ -303,6 +303,7 @@ htmlNodeInfoPop(htmlParserCtxtPtr ctxt) #define UPP(val) (toupper(ctxt->input->cur[(val)])) #define CUR_PTR ctxt->input->cur +#define BASE_PTR ctxt->input->base #define SHRINK if ((ctxt->input->cur - ctxt->input->base > 2 * INPUT_CHUNK) && \ (ctxt->input->end - ctxt->input->cur < 2 * INPUT_CHUNK)) \ @@ -1177,7 +1178,7 @@ static const char *const htmlScriptAttributes[] = { "onfocus", "onblur", "onsubmit", - "onrest", + "onreset", "onchange", "onselect" }; @@ -2471,6 +2472,10 @@ htmlParseName(htmlParserCtxtPtr ctxt) { (*in == '_') || (*in == '-') || (*in == ':') || (*in == '.')) in++; + + if (in == ctxt->input->end) + return(NULL); + if ((*in > 0) && (*in < 0x80)) { count = in - ctxt->input->cur; ret = xmlDictLookup(ctxt->dict, ctxt->input->cur, count); @@ -2488,6 +2493,7 @@ htmlParseNameComplex(xmlParserCtxtPtr ctxt) { int len = 0, l; int c; int count = 0; + const xmlChar *base = ctxt->input->base; /* * Handler for more complex cases @@ -2513,7 +2519,18 @@ htmlParseNameComplex(xmlParserCtxtPtr ctxt) { len += l; NEXTL(l); c = CUR_CHAR(l); + if (ctxt->input->base != base) { + /* + * We changed encoding from an unknown encoding + * Input buffer changed location, so we better start again + */ + return(htmlParseNameComplex(ctxt)); + } } + + if (ctxt->input->base > ctxt->input->cur - len) + return(NULL); + return(xmlDictLookup(ctxt->dict, ctxt->input->cur - len, len)); } @@ -2765,31 +2782,43 @@ htmlParseAttValue(htmlParserCtxtPtr ctxt) { static xmlChar * htmlParseSystemLiteral(htmlParserCtxtPtr ctxt) { - const xmlChar *q; + size_t len = 0, startPosition = 0; xmlChar *ret = NULL; if (CUR == '"') { NEXT; - q = CUR_PTR; - while ((IS_CHAR_CH(CUR)) && (CUR != '"')) + + if (CUR_PTR < BASE_PTR) + return(ret); + startPosition = CUR_PTR - BASE_PTR; + + while ((IS_CHAR_CH(CUR)) && (CUR != '"')) { NEXT; + len++; + } if (!IS_CHAR_CH(CUR)) { htmlParseErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED, "Unfinished SystemLiteral\n", NULL, NULL); } else { - ret = xmlStrndup(q, CUR_PTR - q); + ret = xmlStrndup((BASE_PTR+startPosition), len); NEXT; } } else if (CUR == '\'') { NEXT; - q = CUR_PTR; - while ((IS_CHAR_CH(CUR)) && (CUR != '\'')) + + if (CUR_PTR < BASE_PTR) + return(ret); + startPosition = CUR_PTR - BASE_PTR; + + while ((IS_CHAR_CH(CUR)) && (CUR != '\'')) { NEXT; + len++; + } if (!IS_CHAR_CH(CUR)) { htmlParseErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED, "Unfinished SystemLiteral\n", NULL, NULL); } else { - ret = xmlStrndup(q, CUR_PTR - q); + ret = xmlStrndup((BASE_PTR+startPosition), len); NEXT; } } else { @@ -2813,32 +2842,47 @@ htmlParseSystemLiteral(htmlParserCtxtPtr ctxt) { static xmlChar * htmlParsePubidLiteral(htmlParserCtxtPtr ctxt) { - const xmlChar *q; + size_t len = 0, startPosition = 0; xmlChar *ret = NULL; /* * Name ::= (Letter | '_') (NameChar)* */ if (CUR == '"') { NEXT; - q = CUR_PTR; - while (IS_PUBIDCHAR_CH(CUR)) NEXT; + + if (CUR_PTR < BASE_PTR) + return(ret); + startPosition = CUR_PTR - BASE_PTR; + + while (IS_PUBIDCHAR_CH(CUR)) { + len++; + NEXT; + } + if (CUR != '"') { htmlParseErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED, "Unfinished PubidLiteral\n", NULL, NULL); } else { - ret = xmlStrndup(q, CUR_PTR - q); + ret = xmlStrndup((BASE_PTR + startPosition), len); NEXT; } } else if (CUR == '\'') { NEXT; - q = CUR_PTR; - while ((IS_PUBIDCHAR_CH(CUR)) && (CUR != '\'')) - NEXT; + + if (CUR_PTR < BASE_PTR) + return(ret); + startPosition = CUR_PTR - BASE_PTR; + + while ((IS_PUBIDCHAR_CH(CUR)) && (CUR != '\'')){ + len++; + NEXT; + } + if (CUR != '\'') { htmlParseErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED, "Unfinished PubidLiteral\n", NULL, NULL); } else { - ret = xmlStrndup(q, CUR_PTR - q); + ret = xmlStrndup((BASE_PTR + startPosition), len); NEXT; } } else { @@ -2948,8 +2992,9 @@ htmlParseScript(htmlParserCtxtPtr ctxt) { /** - * htmlParseCharData: + * htmlParseCharDataInternal: * @ctxt: an HTML parser context + * @readahead: optional read ahead character in ascii range * * parse a CharData section. * if we are within a CDATA section ']]>' marks an end of section. @@ -2958,12 +3003,15 @@ htmlParseScript(htmlParserCtxtPtr ctxt) { */ static void -htmlParseCharData(htmlParserCtxtPtr ctxt) { - xmlChar buf[HTML_PARSER_BIG_BUFFER_SIZE + 5]; +htmlParseCharDataInternal(htmlParserCtxtPtr ctxt, int readahead) { + xmlChar buf[HTML_PARSER_BIG_BUFFER_SIZE + 6]; int nbchar = 0; int cur, l; int chunk = 0; + if (readahead) + buf[nbchar++] = readahead; + SHRINK; cur = CUR_CHAR(l); while (((cur != '<') || (ctxt->token == '<')) && @@ -3042,6 +3090,21 @@ htmlParseCharData(htmlParserCtxtPtr ctxt) { } } +/** + * htmlParseCharData: + * @ctxt: an HTML parser context + * + * parse a CharData section. + * if we are within a CDATA section ']]>' marks an end of section. + * + * [14] CharData ::= [^<&]* - ([^<&]* ']]>' [^<&]*) + */ + +static void +htmlParseCharData(htmlParserCtxtPtr ctxt) { + htmlParseCharDataInternal(ctxt, 0); +} + /** * htmlParseExternalID: * @ctxt: an HTML parser context @@ -3245,12 +3308,17 @@ htmlParseComment(htmlParserCtxtPtr ctxt) { ctxt->instate = state; return; } + len = 0; + buf[len] = 0; q = CUR_CHAR(ql); + if (!IS_CHAR(q)) + goto unfinished; NEXTL(ql); r = CUR_CHAR(rl); + if (!IS_CHAR(r)) + goto unfinished; NEXTL(rl); cur = CUR_CHAR(l); - len = 0; while (IS_CHAR(cur) && ((cur != '>') || (r != '-') || (q != '-'))) { @@ -3281,18 +3349,20 @@ htmlParseComment(htmlParserCtxtPtr ctxt) { } } buf[len] = 0; - if (!IS_CHAR(cur)) { - htmlParseErr(ctxt, XML_ERR_COMMENT_NOT_FINISHED, - "Comment not terminated \nEBCDIC wrappers for system and external library calls (Patrick Monnerat), + OS400: Easy character transcoding support (Patrick Monnerat), + OS400: iconv functions compatibility wrappers and table builder. (Patrick Monnerat), + OS400: create architecture directory. Implement dlfcn emulation. (Patrick Monnerat), + Fix building when configuring without xpath and xptr (Daniel Veillard), + configure: Add --with-python-install-dir (Jonas Eriksson), + Fix compilation with minimum and xinclude. (Nicolas Le Cam), + Compile out use of xmlValidateNCName() when not available. (Nicolas Le Cam), + Fix compilation with minimum and schematron. (Nicolas Le Cam), + Legacy needs xmlSAX2StartElement() and xmlSAX2EndElement(). (Nicolas Le Cam), + Don't use xmlValidateName() when not available. (Nicolas Le Cam), + Fix a portability issue on Windows (Longstreth Jon), + Various portability patches for OpenVMS (Jacob (Jouk) Jansen), + Use specific macros for portability to OS/400 (Patrick Monnerat), + Add macros needed for OS/400 portability (Patrick Monnerat), + Portability patch for fopen on OS/400 (Patrick Monnerat), + Portability fixes for OS/400 (Patrick Monnerat), + Improve va_list portability (Patrick Monnerat), + Portability fix (Patrick Monnerat), + Portability fix (Patrick Monnerat), + Generic portability fix (Patrick Monnerat), + Shortening lines in headers (Patrick Monnerat), + build: Use pkg-config to find liblzma in preference to AC_CHECK_LIB (Philip Withnall), + build: Add @LZMA_LIBS@ to libxml’s pkg-config files (Philip Withnall), + fix some tabs mixing incompatible with python3 (Daniel Veillard), + add additional defines checks for support "./configure --with-minimum" (Denis Pauk), + Another round of fixes for older versions of Python (Arfrever Frehtes Taifersar Arahesis), + python: fix drv_libxml2.py for python3 compatibility (Alexandre Rostovtsev), + python: Fix compiler warnings when building python3 bindings (Armin K), + Fix for compilation with python 2.6.8 (Petr Sumbera) + + - Improvements: + win32/libxml2.def.src after rebuild in doc (Roumen Petrov), + elfgcchack.h: more legacy needs xmlSAX2StartElement() and xmlSAX2EndElement() (Roumen Petrov), + elfgcchack.h: add xmlXPathNodeEval and xmlXPathSetContextNode (Roumen Petrov), + Provide cmake module (Samuel Martin), + Fix a couple of issues raised by make dist (Daniel Veillard), + Fix and add const qualifiers (Kurt Roeckx), + Preparing for upcoming release of 2.9.2 (Daniel Veillard), + Fix zlib and lzma libraries check via command line (Dmitriy), + wrong error column in structured error when parsing end tag (Juergen Keil), + doc/news.html: small update to avoid line join while generating NEWS. (Patrick Monnerat), + Add methods for python3 iterator (Ron Angeles), + Support element node traversal in document fragments. (Kyle VanderBeek), + xmlNodeSetName: Allow setting the name to a substring of the currently set name (Tristan Van Berkom), + Added macros for argument casts (Eric Zurcher), + adding init calls to xml and html Read parsing entry points (Daniel Veillard), + Get rid of 'REPLACEMENT CHARACTER' Unicode chars in xmlschemas.c (Jan Pokorný), + Implement choice for name classes on attributes (Shaun McCance), + Two small namespace tweaks (Daniel Veillard), + xmllint --memory should fail on empty files (Daniel Veillard), + Cast encoding name to char pointer to match arg type (Nikolay Sivov) + + - Cleanups: + Removal of old configure.in (Daniel Veillard), + Unreachable code in tree.c (Gaurav Gupta), + Remove a couple of dead conditions (Gaurav Gupta), + Avoid some dead code and cleanup in relaxng.c (Gaurav), + Drop not needed checks (Denis Pauk), + Fix a wrong test (Daniel Veillard) + + + +2.9.1: Apr 19 2013: + - Features: + Support for Python3 (Daniel Veillard), + Add xmlXPathSetContextNode and xmlXPathNodeEval (Alex Bligh) + + - Documentation: + Add documentation for xmllint --xpath (Daniel Veillard), + Fix the URL of the SAX documentation from James (Daniel Veillard), + Fix spelling of "length". (Michael Wood) + + - Portability: + Fix python bindings with versions older than 2.7 (Daniel Veillard), + rebuild docs:Makefile.am (Roumen Petrov), + elfgcchack.h after rebuild in doc (Roumen Petrov), + elfgcchack for buf module (Roumen Petrov), + Fix a uneeded and wrong extra link parameter (Daniel Veillard), + Few cleanup patches for Windows (Denis Pauk), + Fix rpmbuild --nocheck (Mark Salter), + Fix for win32/configure.js and WITH_THREAD_ALLOC (Daniel Richard), + Fix Broken multi-arch support in xml2-config (Daniel Veillard), + Fix a portability issue for GCC < 3.4.0 (Daniel Veillard), + Windows build fixes (Daniel Richard), + Fix a thread portability problem (Friedrich Haubensak), + Downgrade autoconf requirement to 2.63 (Daniel Veillard) + + - Bug Fixes: + Fix a linking error for python bindings (Daniel Veillard), + Fix a couple of return without value (Jüri Aedla), + Improve the hashing functions (Daniel Franke), + Improve handling of xmlStopParser() (Daniel Veillard), + Remove risk of lockup in dictionary initialization (Daniel Veillard), + Activate detection of encoding in external subset (Daniel Veillard), + Fix an output buffer flushing conversion bug (Mikhail Titov), + Fix an old bug in xmlSchemaValidateOneElement (Csaba László), + Fix configure cannot remove messages (Gilles Espinasse), + fix schema validation in combination with xsi:nil (Daniel Veillard), + xmlCtxtReadFile doesn't work with literal IPv6 URLs (Steve Wolf), + Fix a few problems with setEntityLoader (Alexey Neyman), + Detect excessive entities expansion upon replacement (Daniel Veillard), + Fix the flushing out of raw buffers on encoding conversions (Daniel, +Veillard), + Fix some buffer conversion issues (Daniel Veillard), + When calling xmlNodeDump make sure we grow the buffer quickly (Daniel, +Veillard), + Fix an error in the progressive DTD parsing code (Dan Winship), + xmllint should not load DTD by default when using the reader (Daniel, +Veillard), + Try IBM-037 when looking for EBCDIC handlers (Petr Sumbera), + Fix potential out of bound access (Daniel Veillard), + Fix large parse of file from memory (Daniel Veillard), + Fix a bug in the nsclean option of the parser (Daniel Veillard), + Fix a regression in 2.9.0 breaking validation while streaming (Daniel, +Veillard), + Remove potential calls to exit() (Daniel Veillard) + + - Improvements: + Regenerated API, and testapi, rebuild documentation (Daniel Veillard), + Fix tree iterators broken by 2to3 script (Daniel Veillard), + update all tests for Python3 and Python2 (Daniel Veillard), + A few more fixes for python 3 affecting libxml2.py (Daniel Veillard), + Fix compilation on Python3 (Daniel Veillard), + Converting apibuild.py to python3 (Daniel Veillard), + First pass at starting porting to python3 (Daniel Veillard), + updated configure.in for python3 (Daniel Veillard), + Add support for xpathRegisterVariable in Python (Shaun McCance), + Added a regression tests from bug 694228 data (Daniel Veillard), + Cache presence of '<' in entities content (Daniel Veillard), + Avoid extra processing on entities (Daniel Veillard), + Python binding for xmlRegisterInputCallback (Alexey Neyman), + Python bindings: DOM casts everything to xmlNode (Alexey Neyman), + Define LIBXML_THREAD_ALLOC_ENABLED via xmlversion.h (Tim Starling), + Adding streaming validation to runtest checks (Daniel Veillard), + Add a --pushsmall option to xmllint (Daniel Veillard) + + - Cleanups: + Switched comment in file to UTF-8 encoding (Daniel Veillard), + Extend gitignore (Daniel Veillard), + Silent the new python test on input (Alexey Neyman), + Cleanup of a duplicate test (Daniel Veillard), + Cleanup on duplicate test expressions (Daniel Veillard), + Fix compiler warning after 153cf15905cf4ec080612ada6703757d10caba1e (Patrick, +Gansterer), + Spec cleanups and a fix for multiarch support (Daniel Veillard), + Silence a clang warning (Daniel Veillard), + Cleanup the Copyright to be pure MIT Licence wording (Daniel Veillard), + rand_seed should be static in dict.c (Wouter Van Rooy), + Fix typos in parser comments (Jan Pokorný) + + + +2.9.0: Sep 11 2012: + - Features: + A few new API entry points, + More resilient push parser mode, + A lot of portability improvement, + Faster XPath evaluation + + - Documentation: + xml2-config.1 markup error (Christian Weisgerber), + libxml(3) manpage typo fix (John Bradshaw), + More cleanups to the documentation part of libxml2 (Daniel Richard G) + + - Portability: + Bug 676544 - fails to build with --without-sax1 (Akira TAGOH), + fix builds not having stdint.h (Rob Richards), + GetProcAddressA is available only on WinCE (Daniel Veillard), + More updates and cleanups on autotools and Makefiles (Daniel Richard G), + More changes for Win32 compilation (Eric Zurcher), + Basic changes for Win32 builds of release 2.9.0: compile buf.c (Eric Zurcher), + Bundles all generated files for python into the distribution (Daniel Richard G), + Fix compiler warnings of wincecompat.c (Patrick Gansterer), + Fix non __GNUC__ build (Patrick Gansterer), + Fix windows unicode build (Patrick Gansterer), + clean redefinition of {v}snprintf in C-source (Roumen Petrov), + use xmlBuf... if DEBUG_INPUT is defined (Roumen Petrov), + fix runtests to use pthreads support for various Unix platforms (Daniel Richard G), + Various "make distcheck" and portability fixups 2nd part (Daniel Richard G), + Various "make distcheck" and portability fixups (Daniel Richard G), + Fix compilation on older Visual Studio (Daniel Veillard) + + - Bug Fixes: + Change the XPath code to percolate allocation errors (Daniel Veillard), + Fix reuse of xmlInitParser (Daniel Veillard), + Fix potential crash on entities errors (Daniel Veillard), + initialize var (Rob Richards), + Fix the XPath arity check to also check the XPath stack limits (Daniel Veillard), + Fix problem with specific and generic error handlers (Pietro Cerutti), + Avoid a potential infinite recursion (Daniel Veillard), + Fix an XSD error when generating internal automata (Daniel Veillard), + Patch for xinclude of text using multibyte characters (Vitaly Ostanin), + Fix a segfault on XSD validation on pattern error (Daniel Veillard), + Fix missing xmlsave.h module which was ignored in recent builds (Daniel Veillard), + Add a missing element check (Daniel Veillard), + Adding various checks on node type though the API (Daniel Veillard), + Namespace nodes can't be unlinked with xmlUnlinkNode (Daniel Veillard), + Fix make dist to include new private header files (Daniel Veillard), + More fixups on the push parser behaviour (Daniel Veillard), + Strengthen behaviour of the push parser in problematic situations (Daniel Veillard), + Enforce XML_PARSER_EOF state handling through the parser (Daniel Veillard), + Fixup limits parser (Daniel Veillard), + Do not fetch external parsed entities (Daniel Veillard), + Fix an error in previous commit (Aron Xu), + Fix entities local buffers size problems (Daniel Veillard), + Fix parser local buffers size problems (Daniel Veillard), + Fix a failure to report xmlreader parsing failures (Daniel Veillard) + + - Improvements: + Keep libxml2.syms when running "make distclean" (Daniel Veillard), + Allow to set the quoting character of an xmlWriter (Csaba Raduly), + Keep non-significant blanks node in HTML parser (Daniel Veillard), + Add a forbidden variable error number and message to XPath (Daniel Veillard), + Support long path names on WNT (Michael Stahl), + Improve HTML escaping of attribute on output (Daniel Veillard), + Handle ICU_LIBS as LIBADD, not LDFLAGS to prevent linking errors (Arfrever Frehtes Taifersar Arahesis), + Switching XPath node sorting to Timsort (Vojtech Fried), + Optimizing '//' in XPath expressions (Nick Wellnhofer), + Expose xmlBufShrink in the public tree API (Daniel Veillard), + Visible HTML elements close the head tag (Conrad Irwin), + Fix file and line report for XSD SAX and reader streaming validation (Daniel Veillard), + Fix const qualifyer to definition of xmlBufferDetach (Daniel Veillard), + minimize use of HAVE_CONFIG_H (Roumen Petrov), + fixup regression in Various "make distcheck" and portability fixups (Roumen Petrov), + Add support for big line numbers in error reporting (Daniel Veillard), + Avoid using xmlBuffer for serialization (Daniel Veillard), + Improve compatibility between xmlBuf and xmlBuffer (Daniel Veillard), + Provide new accessors for xmlOutputBuffer (Daniel Veillard), + Improvements for old buffer compatibility (Daniel Veillard), + Expand the limit test program (Daniel Veillard), + Improve error reporting on parser errors (Daniel Veillard), + Implement some default limits in the XPath module (Daniel Veillard), + Introduce some default parser limits (Daniel Veillard), + Cleanups and new limit APIs for dictionaries (Daniel Veillard), + Fixup for buf.c (Daniel Veillard), + Cleanup URI module memory allocation code (Daniel Veillard), + Extend testlimits (Daniel Veillard), + More avoid quadratic behaviour (Daniel Veillard), + Impose a reasonable limit on PI size (Daniel Veillard), + first version of testlimits new test (Daniel Veillard), + Avoid quadratic behaviour in some push parsing cases (Daniel Veillard), + Impose a reasonable limit on comment size (Daniel Veillard), + Impose a reasonable limit on attribute size (Daniel Veillard), + Harden the buffer code and make it more compatible (Daniel Veillard), + More cleanups for input/buffers code (Daniel Veillard), + Cleanup function xmlBufResetInput(), to set input from Buffer (Daniel Veillard) + Swicth the test program for characters to new input buffers (Daniel Veillard), + Convert the HTML tree module to the new buffers (Daniel Veillard), + Convert of the HTML parser to new input buffers (Daniel Veillard), + Convert the writer to new output buffer and save APIs (Daniel Veillard), + Convert XMLReader to the new input buffers (Daniel Veillard), + New saving functions using xmlBuf and conversion (Daniel Veillard), + Provide new xmlBuf based saving functions (Daniel Veillard), + Convert XInclude to the new input buffers (Daniel Veillard), + Convert catalog code to the new input buffers (Daniel Veillard), + Convert C14N to the new Input buffer (Daniel Veillard), + Convert xmlIO.c to the new input and output buffers (Daniel Veillard), + Convert XML parser to the new input buffers (Daniel Veillard), + Incompatible change to the Input and Output buffers (Daniel Veillard), + Adding new encoding function to deal with the new structures (Daniel Veillard), + Convert XPath to xmlBuf (Daniel Veillard), + Adding a new buf module for buffers (Daniel Veillard), + Memory error within SAX2 reuse common framework (Daniel Veillard), + Fix xmllint --xpath node initialization (Daniel Veillard) + + - Cleanups: + Various cleanups to avoid compiler warnings (Daniel Veillard), + Big space and tab cleanup (Daniel Veillard), + Followup to LibXML2 docs/examples cleanup patch (Daniel Veillard), + Second round of cleanups for LibXML2 docs/examples (Daniel Richard), + Remove all .cvsignore as they are not used anymore (Daniel Veillard), + Fix a Timsort function helper comment (Daniel Veillard), + Small cleanup for valgrind target (Daniel Veillard), + Patch for portability of latin characters in C files (Daniel Veillard), + Cleanup some of the parser code (Daniel Veillard), + Fix a variable name in comment (Daniel Veillard), + Regenerated testapi.c (Daniel Veillard), + Regenerating docs and API files (Daniel Veillard), + Small cleanup of unused variables in test (Daniel Veillard), + Expand .gitignore with more files (Daniel Veillard) + + + +2.8.0: May 23 2012: + - Features: + add lzma compression support (Anders F Bjorklund) + + - Documentation: + xmlcatalog: Add uri and delegateURI to possible add types in man page. (Ville Skyttä), + Update README.tests (Daniel Veillard), + URI handling code is not OOM resilient (Daniel Veillard), + Fix an error in comment (Daniel Veillard), + Fixed bug #617016 (Daniel Mustieles), + Fixed two typos in the README document (Daniel Neel), + add generated html files (Anders F Bjorklund), + Clarify the need to use xmlFreeNode after xmlUnlinkNode (Daniel Veillard), + Improve documentation a bit (Daniel Veillard), + Updated URL for lxml python bindings (Daniel Veillard) + + - Portability: + Restore code for Windows compilation (Daniel Veillard), + Remove git error message during configure (Christian Dywan), + xmllint: Build fix for endTimer if !defined(HAVE_GETTIMEOFDAY) (Patrick R. Gansterer), + remove a bashism in confgure.in (John Hein), + undef ERROR if already defined (Patrick R. Gansterer), + Fix library problems with mingw-w64 (Michael Cronenworth), + fix windows build. ifdef addition from bug 666491 makes no sense (Rob Richards), + prefer native threads on win32 (Sam Thursfield), + Allow to compile with Visual Studio 2010 (Thomas Lemm), + Fix mingw's snprintf configure check (Andoni Morales), + fixed a 64bit big endian issue (Marcus Meissner), + Fix portability failure if netdb.h lacks NO_ADDRESS (Daniel Veillard), + Fix windows build from lzma addition (Rob Richards), + autogen: Only check for libtoolize (Colin Walters), + Fix the Windows build files (Patrick von Reth), + 634846 Remove a linking option breaking Windows VC10 (Daniel Veillard), + 599241 fix an initialization problem on Win64 (Andrew W. Nosenko), + fix win build (Rob Richards) + + - Bug fixes: + Part for rand_r checking missing (Daniel Veillard), + Cleanup on randomization (Daniel Veillard), + Fix undefined reference in python module (Pacho Ramos), + Fix a race in xmlNewInputStream (Daniel Veillard), + Fix weird streaming RelaxNG errors (Noam), + Fix various bugs in new code raised by the API checking (Daniel Veillard), + Fix various problems with "make dist" (Daniel Veillard), + Fix a memory leak in the xzlib code (Daniel Veillard), + HTML parser error with