[LIBXML2] Update to version 2.9.13. CORE-17766

This commit is contained in:
Thomas Faber 2022-11-19 15:10:13 -05:00
parent df1adce32c
commit 7244e0c5c6
No known key found for this signature in database
GPG key ID: 076E7C3D44720826
35 changed files with 1127 additions and 20110 deletions

View file

@ -239,7 +239,7 @@ URL: https://github.com/win-iconv/win-iconv
Title: LibXML
Path: sdk/lib/3rdparty/libxml2
Used Version: 2.9.12
Used Version: 2.9.13
License: MIT (https://spdx.org/licenses/MIT.htmlf)
URL: http://xmlsoft.org, ftp://xmlsoft.org/libxml2/

View file

@ -29,28 +29,28 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* the version string like "1.2.3"
*/
#define LIBXML_DOTTED_VERSION "2.9.12"
#define LIBXML_DOTTED_VERSION "2.9.13"
/**
* LIBXML_VERSION:
*
* the version number: 1.2.3 value is 10203
*/
#define LIBXML_VERSION 20912
#define LIBXML_VERSION 20913
/**
* LIBXML_VERSION_STRING:
*
* the version number string, 1.2.3 value is "10203"
*/
#define LIBXML_VERSION_STRING "20912"
#define LIBXML_VERSION_STRING "20913"
/**
* LIBXML_VERSION_EXTRA:
*
* extra version information, used to show a CVS compilation
* extra version information, used to show a git commit description
*/
#define LIBXML_VERSION_EXTRA "-GITv2.9.11"
#define LIBXML_VERSION_EXTRA "-GITv2.9.12-115-ga075d256f"
/**
* LIBXML_TEST_VERSION:
@ -58,7 +58,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
* Macro to check that the libxml version in use is compatible with
* the version the software has been compiled against
*/
#define LIBXML_TEST_VERSION xmlCheckVersion(20912);
#define LIBXML_TEST_VERSION xmlCheckVersion(20913);
#ifndef VMS
#if 0

View file

@ -48,7 +48,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
/**
* LIBXML_VERSION_EXTRA:
*
* extra version information, used to show a CVS compilation
* extra version information, used to show a git commit description
*/
#define LIBXML_VERSION_EXTRA "@LIBXML_VERSION_EXTRA@"

View file

@ -1,5 +0,0 @@
Daniel Veillard <daniel@veillard.com>
Bjorn Reese <breese@users.sourceforge.net>
William Brack <wbrack@mmm.com.hk>
Igor Zlatkovic <igor@zlatkovic.com> for the Windows port
Aleksey Sanin <aleksey@aleksey.com>

File diff suppressed because it is too large Load diff

View file

@ -2517,6 +2517,8 @@ htmlNewDocNoDtD(const xmlChar *URI, const xmlChar *ExternalID) {
if ((ExternalID != NULL) ||
(URI != NULL))
xmlCreateIntSubset(cur, BAD_CAST "html", ExternalID, URI);
if ((__xmlRegisterCallbacks) && (xmlRegisterNodeDefaultValue))
xmlRegisterNodeDefaultValue((xmlNodePtr)cur);
return(cur);
}
@ -3045,7 +3047,7 @@ htmlParsePubidLiteral(htmlParserCtxtPtr ctxt) {
NEXT;
}
if (CUR != '"') {
if (CUR != quote) {
htmlParseErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED,
"Unfinished PubidLiteral\n", NULL, NULL);
} else {
@ -3958,13 +3960,25 @@ htmlParseStartTag(htmlParserCtxtPtr ctxt) {
htmlParseErr(ctxt, XML_ERR_NAME_REQUIRED,
"htmlParseStartTag: invalid element name\n",
NULL, NULL);
/*
* The recovery code is disabled for now as it can result in
* quadratic behavior with the push parser. htmlParseStartTag
* must consume all content up to the final '>' in order to avoid
* rescanning for this terminator.
*
* For a proper fix in line with HTML5, htmlParseStartTag and
* htmlParseElement should only be called when there's an ASCII
* alpha character following the initial '<'. Otherwise, the '<'
* should be emitted as text (unless followed by '!', '/' or '?').
*/
#if 0
/* if recover preserve text on classic misconstructs */
if ((ctxt->recovery) && ((IS_BLANK_CH(CUR)) || (CUR == '<') ||
(CUR == '=') || (CUR == '>') || (((CUR >= '0') && (CUR <= '9'))))) {
htmlParseCharDataInternal(ctxt, '<');
return(-1);
}
#endif
/* Dump the bogus tag like browsers do */
while ((CUR != 0) && (CUR != '>') &&
@ -5185,6 +5199,7 @@ htmlCreateMemoryParserCtxt(const char *buffer, int size) {
input = xmlNewInputStream(ctxt);
if (input == NULL) {
xmlFreeParserInputBuffer(buf);
xmlFreeParserCtxt(ctxt);
return(NULL);
}
@ -5992,32 +6007,12 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
} else if (cur == '<') {
if ((!terminate) && (next == 0))
goto done;
/*
* Only switch to START_TAG if the next character
* starts a valid name. Otherwise, htmlParseStartTag
* might return without consuming all characters
* up to the final '>'.
*/
if ((IS_ASCII_LETTER(next)) ||
(next == '_') || (next == ':') || (next == '.')) {
ctxt->instate = XML_PARSER_START_TAG;
ctxt->checkIndex = 0;
ctxt->instate = XML_PARSER_START_TAG;
ctxt->checkIndex = 0;
#ifdef DEBUG_PUSH
xmlGenericError(xmlGenericErrorContext,
"HPP: entering START_TAG\n");
xmlGenericError(xmlGenericErrorContext,
"HPP: entering START_TAG\n");
#endif
} else {
htmlParseErr(ctxt, XML_ERR_NAME_REQUIRED,
"htmlParseTryOrFinish: "
"invalid element name\n",
NULL, NULL);
htmlCheckParagraph(ctxt);
if ((ctxt->sax != NULL) &&
(ctxt->sax->characters != NULL))
ctxt->sax->characters(ctxt->userData,
in->cur, 1);
NEXT;
}
break;
} else {
/*
@ -6999,7 +6994,9 @@ htmlReadMemory(const char *buffer, int size, const char *URL, const char *encodi
* @encoding: the document encoding, or NULL
* @options: a combination of htmlParserOption(s)
*
* parse an XML from a file descriptor and build a tree.
* parse an HTML from a file descriptor and build a tree.
* NOTE that the file descriptor will not be closed when the
* reader is closed or reset.
*
* Returns the resulting document tree
*/
@ -7008,17 +7005,17 @@ htmlReadFd(int fd, const char *URL, const char *encoding, int options)
{
htmlParserCtxtPtr ctxt;
xmlParserInputBufferPtr input;
xmlParserInputPtr stream;
htmlParserInputPtr stream;
if (fd < 0)
return (NULL);
xmlInitParser();
xmlInitParser();
input = xmlParserInputBufferCreateFd(fd, XML_CHAR_ENCODING_NONE);
if (input == NULL)
return (NULL);
ctxt = xmlNewParserCtxt();
input->closecallback = NULL;
ctxt = htmlNewParserCtxt();
if (ctxt == NULL) {
xmlFreeParserInputBuffer(input);
return (NULL);
@ -7026,7 +7023,7 @@ htmlReadFd(int fd, const char *URL, const char *encoding, int options)
stream = xmlNewIOInputStream(ctxt, input, XML_CHAR_ENCODING_NONE);
if (stream == NULL) {
xmlFreeParserInputBuffer(input);
xmlFreeParserCtxt(ctxt);
htmlFreeParserCtxt(ctxt);
return (NULL);
}
inputPush(ctxt, stream);

View file

@ -744,7 +744,7 @@ void
htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
xmlNodePtr cur, const char *encoding ATTRIBUTE_UNUSED,
int format) {
xmlNodePtr root;
xmlNodePtr root, parent;
xmlAttrPtr attr;
const htmlElemDesc * info;
@ -755,6 +755,7 @@ htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
}
root = cur;
parent = cur->parent;
while (1) {
switch (cur->type) {
case XML_HTML_DOCUMENT_NODE:
@ -763,12 +764,28 @@ htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
htmlDtdDumpOutput(buf, (xmlDocPtr) cur, NULL);
}
if (cur->children != NULL) {
cur = cur->children;
continue;
/* Always validate cur->parent when descending. */
if (cur->parent == parent) {
parent = cur;
cur = cur->children;
continue;
}
} else {
xmlOutputBufferWriteString(buf, "\n");
}
break;
case XML_ELEMENT_NODE:
/*
* Some users like lxml are known to pass nodes with a corrupted
* tree structure. Fall back to a recursive call to handle this
* case.
*/
if ((cur->parent != parent) && (cur->children != NULL)) {
htmlNodeDumpFormatOutput(buf, doc, cur, encoding, format);
break;
}
/*
* Get specific HTML info for that node.
*/
@ -817,6 +834,7 @@ htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
(cur->name != NULL) &&
(cur->name[0] != 'p')) /* p, pre, param */
xmlOutputBufferWriteString(buf, "\n");
parent = cur;
cur = cur->children;
continue;
}
@ -825,9 +843,9 @@ htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
(info != NULL) && (!info->isinline)) {
if ((cur->next->type != HTML_TEXT_NODE) &&
(cur->next->type != HTML_ENTITY_REF_NODE) &&
(cur->parent != NULL) &&
(cur->parent->name != NULL) &&
(cur->parent->name[0] != 'p')) /* p, pre, param */
(parent != NULL) &&
(parent->name != NULL) &&
(parent->name[0] != 'p')) /* p, pre, param */
xmlOutputBufferWriteString(buf, "\n");
}
@ -842,9 +860,9 @@ htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
break;
if (((cur->name == (const xmlChar *)xmlStringText) ||
(cur->name != (const xmlChar *)xmlStringTextNoenc)) &&
((cur->parent == NULL) ||
((xmlStrcasecmp(cur->parent->name, BAD_CAST "script")) &&
(xmlStrcasecmp(cur->parent->name, BAD_CAST "style"))))) {
((parent == NULL) ||
((xmlStrcasecmp(parent->name, BAD_CAST "script")) &&
(xmlStrcasecmp(parent->name, BAD_CAST "style"))))) {
xmlChar *buffer;
buffer = xmlEncodeEntitiesReentrant(doc, cur->content);
@ -902,13 +920,9 @@ htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
break;
}
/*
* The parent should never be NULL here but we want to handle
* corrupted documents gracefully.
*/
if (cur->parent == NULL)
return;
cur = cur->parent;
cur = parent;
/* cur->parent was validated when descending. */
parent = cur->parent;
if ((cur->type == XML_HTML_DOCUMENT_NODE) ||
(cur->type == XML_DOCUMENT_NODE)) {
@ -939,9 +953,9 @@ htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
(cur->next != NULL)) {
if ((cur->next->type != HTML_TEXT_NODE) &&
(cur->next->type != HTML_ENTITY_REF_NODE) &&
(cur->parent != NULL) &&
(cur->parent->name != NULL) &&
(cur->parent->name[0] != 'p')) /* p, pre, param */
(parent != NULL) &&
(parent->name != NULL) &&
(parent->name[0] != 'p')) /* p, pre, param */
xmlOutputBufferWriteString(buf, "\n");
}
}

View file

@ -1,15 +1,498 @@
NEWS file for libxml2
Note that this is automatically generated from the news webpage at:
http://xmlsoft.org/news.html
The change log at
ChangeLog.html
describes the recents commits
to the GIT at
https://gitlab.gnome.org/GNOME/libxml2
code base.Here is the list of public releases:
v2.9.13: Feb 19 2022:
- Security:
[CVE-2022-23308] Use-after-free of ID and IDREF attributes
(Thanks to Shinji Sato for the report)
Use-after-free in xmlXIncludeCopyRange (David Kilzer)
Fix Null-deref-in-xmlSchemaGetComponentTargetNs (huangduirong)
Fix memory leak in xmlXPathCompNodeTest
Fix null pointer deref in xmlStringGetNodeList
Fix several memory leaks found by Coverity (David King)
- Fixed regressions:
Fix regression in RelaxNG pattern matching
Properly handle nested documents in xmlFreeNode
Fix regression with PEs in external DTD
Fix random dropping of characters on dumping ASCII encoded XML (Mohammad Razavi)
Revert "Make schema validation fail with multiple top-level elements"
Fix regression when parsing invalid HTML tags in push mode
Fix regression parsing public IDs literals in HTML
Fix buffering in xmlOutputBufferWrite
Fix whitespace when serializing empty HTML documents
Fix XPath recursion limit
Fix regression in xmlNodeDumpOutputInternal
Work around lxml API abuse
- Bug fixes:
Fix xmlSetTreeDoc with entity references
Fix double counting of CRLF in comments
Make sure to grow input buffer in xmlParseMisc
Don't ignore xmllint options after "-"
Don't normalize namespace URIs in XPointer xmlns() scheme
Fix handling of XSD with empty namespace
Also register HTML document nodes
Make xmllint return an error if arguments are missing
Fix handling of ctxt->base in xmlXPtrEvalXPtrPart
Fix xmllint --maxmem
Fix htmlReadFd, which was using a mix of xml and html context functions (Finn Barber)
Move current position before possible calling of ctxt->sax->characters (Yulin Li)
Fix parse failure when 4-byte character in UTF-16 BE is split across a chunk (David Kilzer)
Patch to forbid epsilon-reduction of final states (Arne Becker)
Avoid segfault at exit when using custom memory functions (Mike Dalessio)
- Tests, code quality, fuzzing:
Remove .travis.yml
Make xmlFuzzReadString return a zero size in error case
Fix unused function warning in testapi.c
Update NewsML DTD in test suite
Add more checks for malloc failures in xmllint.c
Avoid potential integer overflow in xmlstring.c
Run CI tests with UBSan implicit-conversion checks
Fix casting of line numbers in SAX2.c
Fix integer conversion warnings in hash.c
Add explicit casts in runtest.c
Fix integer conversion warning in xmlIconvWrapper
Add suffix to unsigned constant in xmlmemory.c
Add explicit casts in testchar.c
Fix integer conversion warnings in xmlstring.c
Add explicit cast in xmlURIUnescapeString
Remove unused variable in xmlCharEncOutFunc (David King)
- Build system, portability:
Remove xmlwin32version.h
Fix fuzzer test with VPATH build
Support custom prefix when installing Python module
Remove Makefile.win
Remove CVS and SVN-related code
Port python 3.x module to Windows and improve distutils (Chun-wei Fan)
Correctly install the HTML examples into their subdirectory (Mattia Rizzolo)
Refactor the settings of $docdir (Mattia Rizzolo)
Remove unused configure checks (Ben Boeckel)
python/Makefile.am: use *_LIBADD, not *_LDFLAGS for LIBS (Sam James)
Fix check for libtool in autogen.sh
Use version in configure.ac for CMake (Timothy Lyanguzov)
Add CMake alias targets for embedded projects (Markus Rickert)
- Documentation:
Remove SVN keyword anchors
Rework README
Remove README.cvs-commits
Remove old ChangeLog
Update hyperlinks
Remove README.docs
Remove MAINTAINERS
Remove xmltutorial.pdf
Upload documentation to GitLab pages
Document how to escape XML_CATALOG_FILES
Fix libxml2.doap
Update URL for libxml++ C++ binding (Kjell Ahlstedt)
Generate devhelp2 index file (Emmanuele Bassi)
Mention XML_CATALOG_FILES is space-separated (Jan Tojnar)
Add documentaiton for xmllint exit code 10 (Rainer Canavan)
Fix some validation errors in the FAQ (David King)
Add instructions on how to use CMake to compile libxml (Markus Rickert)
v2.9.12: May 13 2021:
- Build system:
Add fuzz.h and seed/regexp to EXTRA_DIST
v2.9.11: May 13 2021:
- Security:
Patch for security issue CVE-2021-3541 (Daniel Veillard)
- Documentation:
Clarify xmlNewDocProp documentation (Nick Wellnhofer)
- Portability:
CMake: Only add postfixes if MSVC (Christopher Degawa),
Fix XPath NaN/Inf for older GCC versions (Nick Wellnhofer),
Use CMake PROJECT_VERSION (Markus Rickert),
Fix warnings in libxml.m4 with autoconf 2.70+. (Simon Josefsson),
Add CI for CMake on MSVC (Markus Rickert),
Update minimum required CMake version (Markus Rickert),
Add variables for configured options to CMake config files (Markus Rickert),
Check if variables exist when defining targets (Markus Rickert),
Check if target exists when reading target properties (Markus Rickert),
Add xmlcatalog target and definition to config files (Markus Rickert),
Remove include directories for link-only dependencies (Markus Rickert),
Fix ICU build in CMake (Markus Rickert),
Configure pkgconfig, xml2-config, and xml2Conf.sh file (Markus Rickert),
Update CMake config files (Markus Rickert),
Add xmlcatalog and xmllint to CMake export (Markus Rickert),
Simplify xmlexports.h (Nick Wellnhofer),
Require dependencies based on enabled CMake options (Markus Rickert),
Use NAMELINK_COMPONENT in CMake install (Markus Rickert),
Add CMake files to EXTRA_DIST (Markus Rickert),
Add missing compile definition for static builds to CMake (Markus Rickert),
Add CI for CMake on Linux and MinGW (Markus Rickert),
Fix variable name in win32/configure.js (Nick Wellnhofer),
Fix version parsing in win32/configure.js (Nick Wellnhofer),
Fix autotools warnings (Nick Wellnhofer),
Update config.h.cmake.in (Markus Rickert),
win32: allow passing *FLAGS on command line (Michael Stahl),
Configure file xmlwin32version.h.in on MSVC (Markus Rickert),
List headers individually (Markus Rickert),
Add CMake build files (Markus Rickert),
Parenthesize Py<type>_Check() in ifs (Miro Hrončok),
Minor fixes to configure.js (Nick Wellnhofer)
- Bug Fixes:
Fix null deref in legacy SAX1 parser (Nick Wellnhofer),
Fix handling of unexpected EOF in xmlParseContent (Nick Wellnhofer),
Fix line numbers in error messages for mismatched tags (Nick Wellnhofer),
Fix htmlTagLookup (Nick Wellnhofer),
Propagate error in xmlParseElementChildrenContentDeclPriv (Nick Wellnhofer),
Fix user-after-free with `xmllint --xinclude --dropdtd` (Nick Wellnhofer),
Fix dangling pointer with `xmllint --dropdtd` (Nick Wellnhofer),
Validate UTF8 in xmlEncodeEntities (Joel Hockey),
Fix use-after-free with `xmllint --html --push` (Nick Wellnhofer),
Allow FP division by zero in xmlXPathInit (Nick Wellnhofer),
Fix xmlGetNodePath with invalid node types (Nick Wellnhofer),
Fix exponential behavior with recursive entities (Nick Wellnhofer),
Fix quadratic behavior when looking up xml:* attributes (Nick Wellnhofer),
Fix slow parsing of HTML with encoding errors (Nick Wellnhofer),
Fix null deref introduced with previous commit (Nick Wellnhofer),
Check for invalid redeclarations of predefined entities (Nick Wellnhofer),
Add the copy of type from original xmlDoc in xmlCopyDoc() (SVGAnimate),
parser.c: shrink the input buffer when appropriate (Mike Dalessio),
Fix infinite loop in HTML parser introduced with recent commits (Nick Wellnhofer),
Fix quadratic runtime when parsing CDATA sections (Nick Wellnhofer),
Fix timeout when handling recursive entities (Nick Wellnhofer),
Fix memory leak in xmlParseElementMixedContentDecl (Nick Wellnhofer),
Fix null deref in xmlStringGetNodeList (Nick Wellnhofer),
use new htmlParseLookupCommentEnd to find comment ends (Mike Dalessio),
htmlParseComment: treat `--!>` as if it closed the comment (Mike Dalessio),
Fix integer overflow in xmlSchemaGetParticleTotalRangeMin (Nick Wellnhofer),
encoding: fix memleak in xmlRegisterCharEncodingHandler() (Xiaoming Ni),
xmlschemastypes.c: xmlSchemaGetFacetValueAsULong add, check "facet->val" (Xiaoming Ni),
Fix null pointer deref in xmlXPtrRangeInsideFunction (Nick Wellnhofer),
Fix quadratic runtime in HTML push parser with null bytes (Nick Wellnhofer),
Avoid quadratic checking of identity-constraints (Michael Matz),
Fix building with ICU 68. (Frederik Seiffert),
Convert python/libxml.c to PY_SSIZE_T_CLEAN (Victor Stinner),
Fix xmlURIEscape memory leaks. (Elliott Hughes),
Avoid call stack overflow with XML reader and recursive XIncludes (Nick Wellnhofer),
Fix caret in regexp character group (Nick Wellnhofer),
parser.c: xmlParseCharData peek behavior fixed wrt newlines (Mike Dalessio),
Fix memory leaks in XPointer string-range function (Nick Wellnhofer),
Fix use-after-free when XIncluding text from Reader (Nick Wellnhofer),
Fix SEGV in xmlSAXParseFileWithData (yanjinjq),
Fix null deref in XPointer expression error path (Nick Wellnhofer),
Don't call xmlXPathInit directly (Nick Wellnhofer),
Fix cleanup of attributes in XML reader (Nick Wellnhofer),
Fix double free in XML reader with XIncludes (Nick Wellnhofer),
Fix memory leak in xmlXIncludeAddNode error paths (Nick Wellnhofer),
Revert "Fix quadratic runtime in xi:fallback processing" (Nick Wellnhofer),
Fix error reporting with xi:fallback (Nick Wellnhofer),
Fix quadratic runtime in xi:fallback processing (Nick Wellnhofer),
Fix corner case with empty xi:fallback (Nick Wellnhofer),
Fix XInclude regression introduced with recent commit (Nick Wellnhofer),
Fix memory leak in runtest.c (Nick Wellnhofer),
Make "xmllint --push --recovery" work (Nick Wellnhofer),
Revert "Do not URI escape in server side includes" (Nick Wellnhofer),
Fix column number accounting in xmlParse*NameAndCompare (Nick Wellnhofer),
Stop counting nbChars in parser context (Nick Wellnhofer),
Fix out-of-bounds read with 'xmllint --htmlout' (Nick Wellnhofer),
Fix exponential runtime and memory in xi:fallback processing (Nick Wellnhofer),
Don't process siblings of root in xmlXIncludeProcess (Nick Wellnhofer),
Don't recurse into xi:include children in xmlXIncludeDoProcess (Nick Wellnhofer),
Fix memory leak in xmlXIncludeIncludeNode error paths (Nick Wellnhofer),
Check for custom free function in global destructor (Nick Wellnhofer),
Fix integer overflow when comparing schema dates (Nick Wellnhofer),
Fix exponential runtime in xmlFARecurseDeterminism (Nick Wellnhofer),
Don't try to handle namespaces when building HTML documents (Nick Wellnhofer),
Fix several quadratic runtime issues in HTML push parser (Nick Wellnhofer),
Fix quadratic runtime when push parsing HTML start tags (Nick Wellnhofer),
Reset XML parser input before reporting errors (David Kilzer),
Fix quadratic runtime when push parsing HTML entity refs (Nick Wellnhofer),
Fix HTML push parser lookahead (Nick Wellnhofer),
Make htmlCurrentChar always translate U+0000 (Nick Wellnhofer),
Fix UTF-8 decoder in HTML parser (Nick Wellnhofer),
Fix quadratic runtime when parsing HTML script content (Nick Wellnhofer),
Reset HTML parser input before reporting error (Nick Wellnhofer),
Fix more quadratic runtime issues in HTML push parser (Nick Wellnhofer),
Fix regression introduced with 477c7f6a (Nick Wellnhofer),
Fix quadratic runtime in HTML parser (Nick Wellnhofer),
Reset HTML parser input before reporting encoding error (Nick Wellnhofer),
Fix integer overflow in xmlFAParseQuantExact (Nick Wellnhofer),
Fix return value of xmlC14NDocDumpMemory (Nick Wellnhofer),
Don't follow next pointer on documents in xmlXPathRunStreamEval (Nick Wellnhofer),
Fix integer overflow in _xmlSchemaParseGYear (Nick Wellnhofer),
Fix integer overflow when parsing {min,max}Occurs (Nick Wellnhofer),
Fix another memory leak in xmlSchemaValAtomicType (Nick Wellnhofer),
Fix unsigned integer overflow in htmlParseTryOrFinish (Nick Wellnhofer),
Fix integer overflow in htmlParseCharRef (Nick Wellnhofer),
Fix undefined behavior in UTF16LEToUTF8 (Nick Wellnhofer),
Fix return value of xmlCharEncOutput (Nick Wellnhofer),
Never expand parameter entities in text declaration (Nick Wellnhofer),
Fix undefined behavior in xmlXPathTryStreamCompile (Nick Wellnhofer),
Fix use-after-free with validating reader (Nick Wellnhofer),
xmlParseBalancedChunkMemory must not be called with NULL doc (Nick Wellnhofer),
Revert "Fix memory leak in xmlParseBalancedChunkMemoryRecover" (Nick Wellnhofer),
Fix memory leak in xmlXIncludeLoadDoc error path (Nick Wellnhofer),
Make schema validation fail with multiple top-level elements (Nick Wellnhofer),
Call xmlCleanupParser on ELF destruction (Samuel Thibault),
Fix copying of entities in xmlParseReference (Nick Wellnhofer),
Fix memory leak in xmlSchemaValidateStream (Zhipeng Xie),
Fix xmlSchemaGetCanonValue formatting for date and dateTime (Kevin Puetz),
Fix memory leak when shared libxml.dll is unloaded (Kevin Puetz),
Fix potentially-uninitialized critical section in Win32 DLL builds (Kevin Puetz),
Fix integer overflow in xmlBufferResize (Nick Wellnhofer),
Check for overflow when allocating two-dimensional arrays (Nick Wellnhofer),
Remove useless comparisons (Nick Wellnhofer),
Fix overflow check in xmlNodeDump (Nick Wellnhofer),
Fix infinite loop in xmlStringLenDecodeEntities (Zhipeng Xie),
Fix freeing of nested documents (Nick Wellnhofer),
Fix more memory leaks in error paths of XPath parser (Nick Wellnhofer),
Fix memory leaks of encoding handlers in xmlsave.c (Nick Wellnhofer),
Fix xml2-config error code (Nick Wellnhofer),
Fix memory leak in error path of XPath expr parser (Nick Wellnhofer),
Fix overflow handling in xmlBufBackToBuffer (Nick Wellnhofer),
Null pointer handling in catalog.c (raniervf),
xml2-config.in: fix regressions introduced by commit 2f2bf4b2c (Dmitry V. Levin)
- Improvements:
Store per-element parser state in a struct (Nick Wellnhofer),
update for xsd:language type check (PaulHiggs),
Update INSTALL.libxml2 (Nick Wellnhofer),
Fix include order in c14n.h (Nick Wellnhofer),
Fix duplicate xmlStrEqual calls in htmlParseEndTag (Nick Wellnhofer),
Speed up htmlCheckAutoClose (Nick Wellnhofer),
Speed up htmlTagLookup (Nick Wellnhofer),
Stop checking attributes for UTF-8 validity (Nick Wellnhofer),
Reduce some fuzzer timeouts (Nick Wellnhofer),
Only run a few CI tests unless scheduled (Nick Wellnhofer),
Improve fuzzer stability (Nick Wellnhofer),
Check for feature flags in fuzzer tests (Nick Wellnhofer),
Another attempt at improving fuzzer stability (Nick Wellnhofer),
Revert "Improve HTML fuzzer stability" (Nick Wellnhofer),
Add charset names to fuzzing dictionaries (Nick Wellnhofer),
Improve HTML fuzzer stability (Nick Wellnhofer),
Add CI for MSVC x86 (Markus Rickert),
Add a flag to not output anything when xmllint succeeded (hhb),
Speed up HTML fuzzer (Nick Wellnhofer),
Remove unused encoding parameter of HTML output functions (Nick Wellnhofer),
Handle malloc failures in fuzzing code (Nick Wellnhofer),
add test coverage for incorrectly-closed comments (Mike Dalessio),
Enforce maximum length of fuzz input (Nick Wellnhofer),
Remove temporary members from struct _xmlXPathContext (Nick Wellnhofer),
Build the Python extension with PY_SSIZE_T_CLEAN (Victor Stinner),
Add CI test for Python 3 (Nick Wellnhofer),
Add fuzzing dictionaries to EXTRA_DIST (Nick Wellnhofer),
Add 'fuzz' subdirectory to DIST_SUBDIRS (Nick Wellnhofer),
Allow port numbers up to INT_MAX (Nick Wellnhofer),
Handle dumps of corrupted documents more gracefully (Nick Wellnhofer),
Limit size of free lists in XML reader when fuzzing (Nick Wellnhofer),
Hardcode maximum XPath recursion depth (Nick Wellnhofer),
Pass URL of main entity in XML fuzzer (Nick Wellnhofer),
Consolidate seed corpus generation (Nick Wellnhofer),
Test fuzz targets with dummy driver (Nick Wellnhofer),
Fix regression introduced with commit d88df4b (Nick Wellnhofer),
Fix regression introduced with commit 74dcc10b (Nick Wellnhofer),
Add TODO comment in xinclude.c (Nick Wellnhofer),
Stop using maxParserDepth in xpath.c (Nick Wellnhofer),
Remove dead code in xinclude.c (Nick Wellnhofer),
Don't add formatting newlines to XInclude nodes (Nick Wellnhofer),
Don't use SAX1 if all element handlers are NULL (Nick Wellnhofer),
Remove unneeded progress checks in HTML parser (Nick Wellnhofer),
Use strcmp when fuzzing (Nick Wellnhofer),
Fix XPath fuzzer (Nick Wellnhofer),
Fuzz XInclude engine (Nick Wellnhofer),
Add XPath and XPointer fuzzer (Nick Wellnhofer),
Update fuzzing code (Nick Wellnhofer),
More *NodeDumpOutput fixes (Nick Wellnhofer),
Fix *NodeDumpOutput functions (Nick Wellnhofer),
Make xmlNodeDumpOutputInternal non-recursive (Nick Wellnhofer),
Make xhtmlNodeDumpOutput non-recursive (Nick Wellnhofer),
Make htmlNodeDumpFormatOutput non-recursive (Nick Wellnhofer),
Fix .gitattributes (Nick Wellnhofer),
Rework control flow in htmlCurrentChar (Nick Wellnhofer),
Make 'xmllint --html --push -' read from stdin (Nick Wellnhofer),
Remove misleading comments in xpath.c (Nick Wellnhofer),
Update to Devhelp index file format version 2 (Andre Klapper),
Set project language to C (Markus Rickert),
Add variable for working directory of XML Conformance Test Suite (Markus Rickert),
Add additional tests and XML Conformance Test Suite (Markus Rickert),
Add command line option for temp directory in runtest (Markus Rickert),
Ensure LF line endings for test files (Markus Rickert),
Enable runtests and testThreads (Markus Rickert),
Limit regexp nesting depth (Nick Wellnhofer),
Fix return values and documentation in encoding.c (Nick Wellnhofer),
Add regexp regression tests (David Kilzer),
Report error for invalid regexp quantifiers (Nick Wellnhofer),
Fix rebuilding docs, by hiding __attribute__((...)) behind a macro. (Martin Vidner),
Copy xs:duration parser from libexslt (Nick Wellnhofer),
Fuzz target for XML Schemas (Nick Wellnhofer),
Move entity recorder to fuzz.c (Nick Wellnhofer),
Fuzz target for HTML parser (Nick Wellnhofer),
Update GitLab CI container (Nick Wellnhofer),
Add options file for xml fuzzer (Nick Wellnhofer),
Add a couple of libFuzzer targets (Nick Wellnhofer),
Guard new calls to xmlValidatePopElement in xml_reader.c (Daniel Cheng),
Add LIBXML_VALID_ENABLED to xmlreader (Łukasz Wojniłowicz),
Fix typos (Nick Wellnhofer),
Disable LeakSanitizer (Nick Wellnhofer),
Stop calling SAX getEntity handler from XMLReader (Nick Wellnhofer),
Add test case for recursive external parsed entities (Nick Wellnhofer),
Enable error tests with entity substitution (Nick Wellnhofer),
Don't load external entity from xmlSAX2GetEntity (Nick Wellnhofer),
Merge code paths loading external entities (Nick Wellnhofer),
Copy some XMLReader option flags to parser context (Nick Wellnhofer),
Add xmlPopOutputCallbacks (Nick Wellnhofer),
Updated Python test reader2.py (Pieter van Oostrum),
Updated python/tests/tstLastError.py (Pieter van Oostrum),
Use random seed in xmlDictComputeFastKey (Ranier Vilela),
Enable more undefined behavior sanitizers (Nick Wellnhofer)
v2.9.10: Oct 30 2019:
- Documentation:
Fix a few more typos ("fonction") (Nick Wellnhofer),
Large batch of typo fixes (Jared Yanovich),
Fix typos: tree: move{ -> s}, reconcil{i -> }ed, h{o -> e}ld by... (Jan Pokorný),
Fix typo: xpath: simpli{ -> fi}ed (Jan Pokorný),
Doc: do not mislead towards "infeasible" scenario wrt. xmlBufNodeDump (Jan Pokorný),
Fix comments in test code (zhouzhongyuan),
fix comment in testReader.c (zhouzhongyuan)
- Portability:
Fix some release issues on Fedora 30 (Daniel Veillard),
Fix exponent digits when running tests under old MSVC (Daniel Richard G),
Work around buggy ceil() function on AIX (Daniel Richard G),
Don't call printf with NULL string in runtest.c (Daniel Richard G),
Switched from unsigned long to ptrdiff_t in parser.c (Stephen Chenney),
timsort.h: support older GCCs (Jérôme Duval),
Make configure.ac work with older pkg-config (Nick Wellnhofer),
Stop defining _REENTRANT on some Win32 platforms (Nick Wellnhofer),
Fix nanohttp.c on MinGW (Nick Wellnhofer),
Fix Windows compiler warning in testC14N.c (Nick Wellnhofer),
Merge testThreadsWin32.c into testThreads.c (Nick Wellnhofer),
Fix Python bindings under Windows (Nick Wellnhofer)
- Bug Fixes:
Another fix for conditional sections at end of document (Nick Wellnhofer),
Fix for conditional sections at end of document (Nick Wellnhofer),
Make sure that Python tests exit with error code (Nick Wellnhofer),
Audit memory error handling in xpath.c (Nick Wellnhofer),
Fix error code in xmlTextWriterStartDocument (Nick Wellnhofer),
Fix integer overflow when counting written bytes (Nick Wellnhofer),
Fix uninitialized memory access in HTML parser (Nick Wellnhofer),
Fix memory leak in xmlSchemaValAtomicType (Nick Wellnhofer),
Disallow conditional sections in internal subset (Nick Wellnhofer),
Fix use-after-free in xmlTextReaderFreeNodeList (Nick Wellnhofer),
Fix Regextests (Nick Wellnhofer),
Fix empty branch in regex (Nick Wellnhofer),
Fix integer overflow in entity recursion check (Nick Wellnhofer),
Don't read external entities or XIncludes from stdin (Nick Wellnhofer),
Fix Schema determinism check of ##other namespaces (Nick Wellnhofer),
Fix potential null deref in xmlSchemaIDCFillNodeTables (zhouzhongyuan),
Fix potential memory leak in xmlBufBackToBuffer (Nick Wellnhofer),
Fix error message when processing XIncludes with fallbacks (Nick Wellnhofer),
Fix memory leak in xmlRegEpxFromParse (zhouzhongyuan),
14:00 is a valid timezone for xs:dateTime (Nick Wellnhofer),
Fix memory leak in xmlParseBalancedChunkMemoryRecover (Zhipeng Xie),
Fix potential null deref in xmlRelaxNGParsePatterns (Nick Wellnhofer),
Misleading error message with xs:{min|max}Inclusive (bettermanzzy),
Fix memory leak in xmlXIncludeLoadTxt (Wang Kirin),
Partial fix for comparison of xs:durations (Nick Wellnhofer),
Fix null deref in xmlreader buffer (zhouzhongyuan),
Fix unability to RelaxNG-validate grammar with choice-based name class (Jan Pokorný),
Fix unability to validate ambiguously constructed interleave for RelaxNG (Jan Pokorný),
Fix possible null dereference in xmlXPathIdFunction (zhouzhongyuan),
fix memory leak in xmlAllocOutputBuffer (zhouzhongyuan),
Fix unsigned int overflow (Jens Eggerstedt),
dict.h: gcc 2.95 doesn't allow multiple storage classes (Nick Wellnhofer),
Fix another code path in xmlParseQName (Nick Wellnhofer),
Make sure that xmlParseQName returns NULL in error case (Nick Wellnhofer),
Fix build without reader but with pattern (Nick Wellnhofer),
Fix memory leak in xmlAllocOutputBufferInternal error path (Nick Wellnhofer),
Fix unsigned integer overflow (Nick Wellnhofer),
Fix return value of xmlOutputBufferWrite (Nick Wellnhofer),
Fix parser termination from "Double hyphen within comment" error (David Warring),
Fix call stack overflow in xmlFreePattern (Nick Wellnhofer),
Fix null deref in previous commit (Nick Wellnhofer),
Fix memory leaks in xmlXPathParseNameComplex error paths (Nick Wellnhofer),
Check for integer overflow in xmlXPtrEvalChildSeq (Nick Wellnhofer),
Fix xmllint dump of XPath namespace nodes (Nick Wellnhofer),
Fix float casts in xmlXPathSubstringFunction (Nick Wellnhofer),
Fix null deref in xmlregexp error path (Nick Wellnhofer),
Fix null pointer dereference in xmlTextReaderReadOuterXml (Nick Wellnhofer),
Fix memory leaks in xmlParseStartTag2 error paths (Nick Wellnhofer),
Fix memory leak in xmlSAX2StartElement (Nick Wellnhofer),
Fix commit "Memory leak in xmlFreeID (xmlreader.c)" (Nick Wellnhofer),
Fix NULL pointer deref in xmlTextReaderValidateEntity (Nick Wellnhofer),
Memory leak in xmlFreeTextReader (Nick Wellnhofer),
Memory leak in xmlFreeID (xmlreader.c) (Nick Wellnhofer)
- Improvements:
Run XML conformance tests under CI (Nick Wellnhofer),
Update GitLab CI config (Nick Wellnhofer),
Propagate memory errors in valuePush (Nick Wellnhofer),
Propagate memory errors in xmlXPathCompExprAdd (Nick Wellnhofer),
Make xmlFreeDocElementContent non-recursive (Nick Wellnhofer),
Enable continuous integration via GitLab CI (Nick Wellnhofer),
Avoid ignored attribute warnings under GCC (Nick Wellnhofer),
Make xmlDumpElementContent non-recursive (Nick Wellnhofer),
Make apibuild.py ignore ATTRIBUTE_NO_SANITIZE (Nick Wellnhofer),
Mark xmlExp* symbols as removed (Nick Wellnhofer),
Make xmlParseConditionalSections non-recursive (Nick Wellnhofer),
Adjust expected error in Python tests (Nick Wellnhofer),
Make xmlTextReaderFreeNodeList non-recursive (Nick Wellnhofer),
Make xmlFreeNodeList non-recursive (Nick Wellnhofer),
Make xmlParseContent and xmlParseElement non-recursive (Nick Wellnhofer),
Remove executable bit from non-executable files (Nick Wellnhofer),
Fix expected output of test/schemas/any4 (Nick Wellnhofer),
Optimize build instructions in README (zhouzhongyuan),
xml2-config.in: Output CFLAGS and LIBS on the same line (Hugh McMaster),
xml2-config: Add a --dynamic switch to print only shared libraries (Hugh McMaster),
Annotate functions with __attribute__((no_sanitize)) (Nick Wellnhofer),
Fix warnings when compiling without reader or push parser (Nick Wellnhofer),
Remove unused member `doc` in xmlSaveCtxt (Nick Wellnhofer),
Limit recursion depth in xmlXPathCompOpEvalPredicate (Nick Wellnhofer),
Remove -Wno-array-bounds (Nick Wellnhofer),
Remove unreachable code in xmlXPathCountFunction (Nick Wellnhofer),
Improve XPath predicate and filter evaluation (Nick Wellnhofer),
Limit recursion depth in xmlXPathOptimizeExpression (Nick Wellnhofer),
Disable hash randomization when fuzzing (Nick Wellnhofer),
Optional recursion limit when parsing XPath expressions (Nick Wellnhofer),
Optional recursion limit when evaluating XPath expressions (Nick Wellnhofer),
Use break statements in xmlXPathCompOpEval (Nick Wellnhofer),
Optional XPath operation limit (Nick Wellnhofer),
Fix compilation with --with-minimum (Nick Wellnhofer),
Check XPath stack after calling functions (Nick Wellnhofer),
Remove debug printf in xmlreader.c (Nick Wellnhofer),
Always define LIBXML_THREAD_ENABLED when enabled (Michael Haubenwallner),
Regenerate NEWS (Nick Wellnhofer),
Change git repo URL (Nick Wellnhofer),
Change bug tracker URL (Nick Wellnhofer),
Remove outdated HTML file (Nick Wellnhofer),
Fix unused function warning in testapi.c (Nick Wellnhofer),
Add some generated test files to .gitignore (Nick Wellnhofer),
Remove unneeded function pointer casts (Nick Wellnhofer),
Fix -Wcast-function-type warnings (GCC 8) (Nick Wellnhofer),
Fix -Wformat-truncation warnings (GCC 8) (Nick Wellnhofer)
- Cleanups:
Rebuild docs (Nick Wellnhofer),
Disable xmlExp regex code (Nick Wellnhofer),
Remove redundant code in xmlRelaxNGValidateState (Nick Wellnhofer),
Remove redundant code in xmlXPathCompRelationalExpr (Nick Wellnhofer)
v2.9.9: Jan 03 2019:
- Security:
CVE-2018-9251 CVE-2018-14567 Fix infinite loop in LZMA decompression (Nick Wellnhofer),
@ -120,7 +603,7 @@ v2.9.8: Mar 05 2018:
2.9.7: Nov 02 2017:
- Documentation:
xmlcatalog: refresh man page wrt. quering system catalog easily (Jan Pokorný)
xmlcatalog: refresh man page wrt. querying system catalog easily (Jan Pokorný)
- Portability:
Fix deprecated Travis compiler flag (Nick Wellnhofer),
@ -440,7 +923,7 @@ v2.9.3: Nov 20 2015:
- Improvements:
Reuse xmlHaltParser() where it makes sense (Daniel Veillard),
xmlStopParser reset errNo (Daniel Veillard),
Reenable xz support by default (Daniel Veillard),
Re-enable xz support by default (Daniel Veillard),
Recover unescaped less-than character in HTML recovery parsing (Daniel Veillard),
Allow HTML serializer to output HTML5 DOCTYPE (Shaun McCance),
Regression test for bug #695699 (Nick Wellnhofer),
@ -814,7 +1297,7 @@ Gansterer),
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),
Switch 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),
@ -909,7 +1392,7 @@ Gansterer),
Avoid memory leak if xmlParserInputBufferCreateIO fails (Lin Yi-Li),
Prevent an infinite loop when dumping a node with encoding problems (Timothy Elliott),
xmlParseNodeInContext problems with an empty document (Tim Elliott),
HTML element position is not detected propperly (Pavel Andrejs),
HTML element position is not detected properly (Pavel Andrejs),
Fix an off by one pointer access (Jüri Aedla),
Try to fix a problem with entities in SAX mode (Daniel Veillard),
Fix a crash with xmllint --path on empty results (Daniel Veillard),
@ -937,7 +1420,7 @@ Gansterer),
Small fix for previous commit (Daniel Veillard),
Fix a potential freeing error in XPath (Daniel Veillard),
Fix a potential memory access error (Daniel Veillard),
Reactivate the shared library versionning script (Daniel Veillard)
Reactivate the shared library versioning script (Daniel Veillard)
- Improvements:
use mingw C99 compatible functions {v}snprintf instead those from MSVC runtime (Roumen Petrov),
@ -1124,7 +1607,7 @@ Gansterer),
Problem with extern extern in header (Daniel Veillard),
Add -lnetwork for compiling on Haiku (Scott McCreary),
Runtest portability patch for Solaris (Tim Rice),
Small patch to accomodate the Haiku OS (Scott McCreary),
Small patch to accommodate the Haiku OS (Scott McCreary),
584605 package VxWorks folder in the distribution (Daniel Veillard),
574017 Realloc too expensive on most platform (Daniel Veillard),
Fix windows build (Rob Richards),
@ -1154,7 +1637,7 @@ Gansterer),
558452 RNG compilation of optional multiple child (Daniel Veillard),
579746 XSD validation not correct / nilable groups (Daniel Veillard),
502960 provide namespace stack when parsing entity (Daniel Veillard),
566012 part 2 fix regresion tests and push mode (Daniel Veillard),
566012 part 2 fix regression tests and push mode (Daniel Veillard),
566012 autodetected encoding and encoding conflict (Daniel Veillard),
584220 xpointer(/) and xinclude problems (Daniel Veillard),
587663 Incorrect Attribute-Value Normalization (Daniel Veillard),
@ -1281,14 +1764,14 @@ Gansterer),
parsing and validation fixes based on the W3C regression tests, reader
tree skipping function fix (Ashwin), Schemas regexps escaping fix
(Volker Grabsch), handling of entity push errors (Ashwin), fix a slowdown
when encoder cant serialize characters on output
when encoder can't serialize characters on output
- Code cleanup: compilation fix without the reader, without the output
(Robert Schwebel), python whitespace (Martin), many space/tabs cleanups,
serious cleanup of the entity handling code
- Improvement: switch parser to XML-1.0 5th edition, add parsing flags
for old versions, switch URI parsing to RFC 3986,
add xmlSchemaValidCtxtGetParserCtxt (Holger Kaelberer),
new hashing functions for dictionnaries (based on Stefan Behnel work),
new hashing functions for dictionaries (based on Stefan Behnel work),
improve handling of misplaced html/head/body in HTML parser, better
regression test tools and code coverage display, better algorithms
to detect various versions of the billion laughts attacks, make
@ -1346,7 +1829,7 @@ Gansterer),
- Code cleanup: fix open() call third argument, regexp cut'n paste
copy error, unused variable in __xmlGlobalInitMutexLock (Hannes Eder),
some make distcheck realted fixes (John Carr)
some make distcheck related fixes (John Carr)
- Improvements: HTTP Header: includes port number (William Brack),
testURI --debug option,
@ -1441,13 +1924,13 @@ Gansterer),
- bug fix: xmlGetNodePath fix (Kasimier), xmlDOMWrapAdoptNode and
attribute (Kasimier), crash when using the recover mode,
xmlXPathEvalExpr problem (Kasimier), xmlXPathCompExprAdd bug (Kasimier),
missing destry in xmlFreeRMutex (Andrew Nosenko), XML Schemas fixes
missing destroy in xmlFreeRMutex (Andrew Nosenko), XML Schemas fixes
(Kasimier), warning on entities processing, XHTML script and style
serialization (Kasimier), python generator for long types, bug in
xmlSchemaClearValidCtxt (Bertrand Fritsch), xmlSchemaXPathEvaluate
allocation bug (Marton Illes), error message end of line (Rob Richards),
fix attribute serialization in writer (Rob Richards), PHP4 DTD validation
crasher, parser safety patch (Ben Darnell), _private context propagation
crash, parser safety patch (Ben Darnell), _private context propagation
when parsing entities (with Michael Day), fix entities behaviour when
using SAX, URI to file path fix (Mikhail Zabaluev), disappearing validity
context, arg error in SAX callback (Mike Hommey), fix mixed-content
@ -1588,7 +2071,7 @@ Do not use or package 2.6.25
Anatolij), xmlSchemaPSimpleTypeErr error report (Kasimier Buchcik), xml:
namespace ahndling in Schemas (Kasimier), empty model group in Schemas
(Kasimier), wildcard in Schemas (Kasimier), URI composition (William),
xs:anyType in Schemas (Kasimier), Python resolver emmitting error
xs:anyType in Schemas (Kasimier), Python resolver emitting error
messages directly, Python xmlAttr.parent (Jakub Piotr Clapa), trying to
fix the file path/URI conversion, xmlTextReaderGetAttribute fix (Rob
Richards), xmlSchemaFreeAnnot memleak (Kasimier), HTML UTF-8
@ -1614,7 +2097,7 @@ Do not use or package 2.6.25
- build fixes: Windows build (Rob Richards), Mingw compilation (Igor
Zlatkovic), Windows Makefile (Igor), gcc warnings (Kasimier and
andriy@google.com), use gcc weak references to pthread to avoid the
pthread dependancy on Linux, compilation problem (Steve Nairn), compiling
pthread dependency on Linux, compilation problem (Steve Nairn), compiling
of subset (Morten Welinder), IPv6/ss_family compilation (William Brack),
compilation when disabling parts of the library, standalone test
distribution.
@ -1655,7 +2138,7 @@ Do not use or package 2.6.25
Linux/ELF/gcc4
- bug fixes: schemas type decimal fixups (William Brack), xmmlint return
code (Gerry Murphy), small schemas fixes (Matthew Burgess and GUY
Fabrice), workaround "DAV:" namespace brokeness in c14n (Aleksey Sanin),
Fabrice), workaround "DAV:" namespace brokenness in c14n (Aleksey Sanin),
segfault in Schemas (Kasimier Buchcik), Schemas attribute validation
(Kasimier), Prop related functions and xmlNewNodeEatName (Rob Richards),
HTML serialization of name attribute on a elements, Python error handlers
@ -1674,7 +2157,7 @@ Do not use or package 2.6.25
Bakefile support (Francesco Montorsi), Windows compilation (Joel Reed),
some gcc4 fixes, HP-UX portability fixes (Rick Jones).
- bug fixes: xmlSchemaElementDump namespace (Kasimier Buchcik), push and
xmlreader stopping on non-fatal errors, thread support for dictionnaries
xmlreader stopping on non-fatal errors, thread support for dictionaries
reference counting (Gary Coady), internal subset and push problem, URL
saved in xmlCopyDoc, various schemas bug fixes (Kasimier), Python paths
fixup (Stephane Bidoul), xmlGetNodePath and namespaces, xmlSetNsProp fix
@ -1729,7 +2212,7 @@ Do not use or package 2.6.25
- bug fixes: problem with XML::Libxml reported by Petr Pajas, encoding
conversion functions return values, UTF-8 bug affecting XPath reported by
Markus Bertheau, catalog problem with NULL entries (William Brack)
- documentation: fix to xmllint man page, some API function descritpion
- documentation: fix to xmllint man page, some API function description
were updated.
- improvements: DTD validation APIs provided at the Python level (Brent
Hendricks)
@ -1869,12 +2352,12 @@ Do not use or package 2.6.25
William), xmlUriEscape (Mark Vakoc), a Relax-NG notAllowed problem (with
William), Relax-NG name classes compares (William), XInclude duplicate
fallback (William), external DTD encoding detection (William), a DTD
validation bug (William), xmlReader Close() fix, recusive extention
validation bug (William), xmlReader Close() fix, recursive extension
schemas
- improvements: use xmlRead* APIs in test tools (Mark Vakoc), indenting
save optimization, better handle IIS broken HTTP redirect behaviour (Ian
Hummel), HTML parser frameset (James Bursa), libxml2-python RPM
dependancy, XML Schemas union support (Kasimier Buchcik), warning removal
dependency, XML Schemas union support (Kasimier Buchcik), warning removal
clanup (William), keep ChangeLog compressed when installing from RPMs
- documentation: examples and xmlDocDumpMemory docs (John Fleck), new
example (load, xpath, modify, save), xmlCatalogDump() comments,
@ -1925,7 +2408,7 @@ Do not use or package 2.6.25
William) reported by Yuuichi Teranishi
- bugfixes: make test and path issues, xmlWriter attribute serialization
(William Brack), xmlWriter indentation (William), schemas validation
(Eric Haszlakiewicz), XInclude dictionnaries issues (William and Oleg
(Eric Haszlakiewicz), XInclude dictionaries issues (William and Oleg
Paraschenko), XInclude empty fallback (William), HTML warnings (William),
XPointer in XInclude (William), Python namespace serialization,
isolat1ToUTF8 bound error (Alfred Mickautsch), output of parameter
@ -1941,12 +2424,12 @@ Do not use or package 2.6.25
- Windows compilation: mingw, msys (Mikhail Grushinskiy), function
prototype (Cameron Johnson), MSVC6 compiler warnings, _WINSOCKAPI_
patch
- Parsers: added xmlByteConsumed(ctxt) API to get the byte offest in
- Parsers: added xmlByteConsumed(ctxt) API to get the byte offset in
input.
2.6.5: Jan 25 2004:
- Bugfixes: dictionnaries for schemas (William Brack), regexp segfault
- Bugfixes: dictionaries for schemas (William Brack), regexp segfault
(William), xs:all problem (William), a number of XPointer bugfixes
(William), xmllint error go to stderr, DTD validation problem with
namespace, memory leak (William), SAX1 cleanup and minimal options fixes
@ -2886,7 +3369,7 @@ Lots of bugfixes, and added a basic SGML catalog support:
also contains numerous fixes and enhancements:
added xmlStopParser() to stop parsing
improved a lot parsing speed when there is large CDATA blocs
improved a lot parsing speed when there is large CDATA blocks
includes XPath patches provided by Picdar Technology
tried to fix as much as possible DTD validation and namespace
related problems
@ -2895,7 +3378,7 @@ Lots of bugfixes, and added a basic SGML catalog support:
- added xmlStopParser() to stop parsing
- improved a lot parsing speed when there is large CDATA blocs
- improved a lot parsing speed when there is large CDATA blocks
- includes XPath patches provided by Picdar Technology
- tried to fix as much as possible DTD validation and namespace
related problems

View file

@ -1,40 +0,0 @@
XML toolkit from the GNOME project
Full documentation is available on-line at
http://xmlsoft.org/
This code is released under the MIT Licence see the Copyright file.
To build on an Unixised setup:
./configure ; make ; make install
if the ./configure file does not exist, run ./autogen.sh instead.
To build on Windows:
see instructions on win32/Readme.txt
To assert build quality:
on an Unixised setup:
run make tests
otherwise:
There is 3 standalone tools runtest.c runsuite.c testapi.c, which
should compile as part of the build or as any application would.
Launch them from this directory to get results, runtest checks
the proper functioning of libxml2 main APIs while testapi does
a full coverage check. Report failures to the list.
To report bugs, follow the instructions at:
http://xmlsoft.org/bugs.html
A mailing-list xml@gnome.org is available, to subscribe:
http://mail.gnome.org/mailman/listinfo/xml
The list archive is at:
http://mail.gnome.org/archives/xml/
All technical answers asked privately will be automatically answered on
the list and archived for public access unless privacy is explicitly
required and justified.
Daniel Veillard
$Id$

121
sdk/lib/3rdparty/libxml2/README.md vendored Normal file
View file

@ -0,0 +1,121 @@
# libxml2
libxml2 is an XML toolkit implemented in C, originally developed for
the GNOME Project.
Full documentation is available at
<https://gitlab.gnome.org/GNOME/libxml2/-/wikis>.
Bugs should be reported at
<https://gitlab.gnome.org/GNOME/libxml2/-/issues>.
A mailing list xml@gnome.org is available. You can subscribe at
<https://mail.gnome.org/mailman/listinfo/xml>. The list archive is at
<https://mail.gnome.org/archives/xml/>.
## License
This code is released under the MIT License, see the Copyright file.
## Build instructions
libxml2 can be built with GNU Autotools, CMake, or several other build
systems in platform-specific subdirectories.
### Autotools (for POSIX systems like Linux, BSD, macOS)
If you build from a Git tree, you have to install Autotools and start
by generating the configuration files with:
./autogen.sh
If you build from a source tarball, extract the archive with:
tar xf libxml2-xxx.tar.gz
cd libxml2-xxx
To see a list of build options:
./configure --help
Also see the INSTALL file for additional instructions. Then you can
configure and build the library:
./configure [possible options]
make
Now you can run the test suite with:
make check
Please report test failures to the mailing list or bug tracker.
Then you can install the library:
make install
At that point you may have to rerun ldconfig or a similar utility to
update your list of installed shared libs.
### CMake (mainly for Windows)
Another option for compiling libxml is using CMake:
cmake -E tar xf libxml2-xxx.tar.gz
cmake -S libxml2-xxx -B libxml2-xxx-build [possible options]
cmake --build libxml2-xxx-build
cmake --install libxml2-xxx-build
Common CMake options include:
-D BUILD_SHARED_LIBS=OFF # build static libraries
-D CMAKE_BUILD_TYPE=Release # specify build type
-D CMAKE_INSTALL_PREFIX=/usr/local # specify the install path
-D LIBXML2_WITH_ICONV=OFF # disable iconv
-D LIBXML2_WITH_LZMA=OFF # disable liblzma
-D LIBXML2_WITH_PYTHON=OFF # disable Python
-D LIBXML2_WITH_ZLIB=OFF # disable libz
You can also open the libxml source directory with its CMakeLists.txt
directly in various IDEs such as CLion, QtCreator, or Visual Studio.
## Dependencies
Libxml does not require any other libraries. A platform with somewhat
recent POSIX support should be sufficient (please report any violation
to this rule you may find).
However, if found at configuration time, libxml will detect and use
the following libraries:
- [libz](https://zlib.net/), a highly portable and widely available
compression library.
- [liblzma](https://tukaani.org/xz/), another compression library.
- [libiconv](https://www.gnu.org/software/libiconv/), a character encoding
conversion library. The iconv function is part of POSIX.1-2001, so
libiconv isn't required on modern UNIX-like systems like Linux, BSD or
macOS.
- [ICU](https://icu.unicode.org/), a Unicode library. Mainly useful as an
alternative to iconv on Windows. Unnecessary on most other systems.
## Contributing
The current version of the code can be found in GNOME's GitLab at
at <https://gitlab.gnome.org/GNOME/libxml2>. The best way to get involved
is by creating issues and merge requests on GitLab. Alternatively, you can
start discussions and send patches to the mailing list. If you want to
work with patches, please format them with git-format-patch and use plain
text attachments.
All code must conform to C89 and pass the GitLab CI tests. Add regression
tests if possible.
## Authors
- Daniel Veillard
- Bjorn Reese
- William Brack
- Igor Zlatkovic for the Windows port
- Aleksey Sanin
- Nick Wellnhofer

View file

@ -742,6 +742,7 @@ xmlSAX2AttributeDecl(void *ctx, const xmlChar *elem, const xmlChar *fullname,
xmlFatalErrMsg(ctxt, XML_ERR_INTERNAL_ERROR,
"SAX.xmlSAX2AttributeDecl(%s) called while not in subset\n",
name, NULL);
xmlFree(name);
xmlFreeEnumeration(tree);
return;
}
@ -1622,10 +1623,10 @@ xmlSAX2StartElement(void *ctx, const xmlChar *fullname, const xmlChar **atts)
ctxt->nodemem = -1;
if (ctxt->linenumbers) {
if (ctxt->input != NULL) {
if (ctxt->input->line < 65535)
ret->line = (short) ctxt->input->line;
if (ctxt->input->line < USHRT_MAX)
ret->line = (unsigned short) ctxt->input->line;
else
ret->line = 65535;
ret->line = USHRT_MAX;
}
}
@ -1886,10 +1887,10 @@ skip:
if (ctxt->linenumbers) {
if (ctxt->input != NULL) {
if (ctxt->input->line < 65535)
ret->line = (short) ctxt->input->line;
if (ctxt->input->line < USHRT_MAX)
ret->line = (unsigned short) ctxt->input->line;
else {
ret->line = 65535;
ret->line = USHRT_MAX;
if (ctxt->options & XML_PARSE_BIG_LINES)
ret->psvi = (void *) (ptrdiff_t) ctxt->input->line;
}
@ -2266,10 +2267,10 @@ xmlSAX2StartElementNs(void *ctx,
}
if (ctxt->linenumbers) {
if (ctxt->input != NULL) {
if (ctxt->input->line < 65535)
ret->line = (short) ctxt->input->line;
if (ctxt->input->line < USHRT_MAX)
ret->line = (unsigned short) ctxt->input->line;
else
ret->line = 65535;
ret->line = USHRT_MAX;
}
}
@ -2688,10 +2689,10 @@ xmlSAX2ProcessingInstruction(void *ctx, const xmlChar *target,
if (ctxt->linenumbers) {
if (ctxt->input != NULL) {
if (ctxt->input->line < 65535)
ret->line = (short) ctxt->input->line;
if (ctxt->input->line < USHRT_MAX)
ret->line = (unsigned short) ctxt->input->line;
else
ret->line = 65535;
ret->line = USHRT_MAX;
}
}
if (ctxt->inSubset == 1) {
@ -2748,10 +2749,10 @@ xmlSAX2Comment(void *ctx, const xmlChar *value)
if (ret == NULL) return;
if (ctxt->linenumbers) {
if (ctxt->input != NULL) {
if (ctxt->input->line < 65535)
ret->line = (short) ctxt->input->line;
if (ctxt->input->line < USHRT_MAX)
ret->line = (unsigned short) ctxt->input->line;
else
ret->line = 65535;
ret->line = USHRT_MAX;
}
}

View file

@ -5,8 +5,6 @@
TODO for the XML parser and stuff:
==================================
$Id$
this tend to be outdated :-\ ...
DOCS:

View file

@ -915,6 +915,7 @@ xmlParseCatalogFile(const char *filename) {
inputStream = xmlNewInputStream(ctxt);
if (inputStream == NULL) {
xmlFreeParserInputBuffer(buf);
xmlFreeParserCtxt(ctxt);
return(NULL);
}
@ -2358,6 +2359,7 @@ xmlParseSGMLCatalog(xmlCatalogPtr catal, const xmlChar *value,
}
if (!IS_BLANK_CH(*cur)) {
/* error */
xmlFree(name);
break;
}
SKIP_BLANKS;

View file

@ -22,7 +22,8 @@
/* Define to 1 if you have the <ctype.h> header file. */
#define HAVE_CTYPE_H 1
/* Define to 1 if you have the <dirent.h> header file. */
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
*/
#define HAVE_DIRENT_H 1
/* Define to 1 if you have the <dlfcn.h> header file. */
@ -61,18 +62,9 @@
/* Define to 1 if you have the `isascii' function. */
/* #undef HAVE_ISASCII */
/* Define if isinf is there */
/* #undef HAVE_ISINF */
/* Define if isnan is there */
#define HAVE_ISNAN /**/
/* Define if history library is there (-lhistory) */
/* #undef HAVE_LIBHISTORY */
/* Define if pthread library is there (-lpthread) */
/* #undef HAVE_LIBPTHREAD */
/* Define if readline library is there (-lreadline) */
/* #undef HAVE_LIBREADLINE */
@ -273,7 +265,7 @@
/* #undef VA_LIST_IS_ARRAY */
/* Version number of package */
#define VERSION "2.9.12"
#define VERSION "2.9.13"
/* Determine what socket length (socklen_t) data type is */
#define XML_SOCKLEN_T int

View file

@ -7973,6 +7973,18 @@ extern __typeof (xmlPopInputCallbacks) xmlPopInputCallbacks__internal_alias __at
#endif
#endif
#if defined(LIBXML_OUTPUT_ENABLED)
#ifdef bottom_xmlIO
#undef xmlPopOutputCallbacks
extern __typeof (xmlPopOutputCallbacks) xmlPopOutputCallbacks __attribute((alias("xmlPopOutputCallbacks__internal_alias")));
#else
#ifndef xmlPopOutputCallbacks
extern __typeof (xmlPopOutputCallbacks) xmlPopOutputCallbacks__internal_alias __attribute((visibility("hidden")));
#define xmlPopOutputCallbacks xmlPopOutputCallbacks__internal_alias
#endif
#endif
#endif
#if defined(LIBXML_TREE_ENABLED)
#ifdef bottom_tree
#undef xmlPreviousElementSibling

View file

@ -527,7 +527,7 @@ UTF16LEToUTF8(unsigned char* out, int *outlen,
in++;
}
if ((c & 0xFC00) == 0xD800) { /* surrogates */
if (in >= inend) { /* (in > inend) shouldn't happens */
if (in >= inend) { /* handle split mutli-byte characters */
break;
}
if (xmlLittleEndian) {
@ -744,38 +744,39 @@ UTF16BEToUTF8(unsigned char* out, int *outlen,
{
unsigned char* outstart = out;
const unsigned char* processed = inb;
unsigned char* outend = out + *outlen;
unsigned char* outend;
unsigned short* in = (unsigned short*) inb;
unsigned short* inend;
unsigned int c, d, inlen;
unsigned char *tmp;
int bits;
if (*outlen == 0) {
*inlenb = 0;
return(0);
}
outend = out + *outlen;
if ((*inlenb % 2) == 1)
(*inlenb)--;
inlen = *inlenb / 2;
inend= in + inlen;
while (in < inend) {
while ((in < inend) && (out - outstart + 5 < *outlen)) {
if (xmlLittleEndian) {
tmp = (unsigned char *) in;
c = *tmp++;
c = c << 8;
c = c | (unsigned int) *tmp;
c = (c << 8) | (unsigned int) *tmp;
in++;
} else {
c= *in++;
}
if ((c & 0xFC00) == 0xD800) { /* surrogates */
if (in >= inend) { /* (in > inend) shouldn't happens */
*outlen = out - outstart;
*inlenb = processed - inb;
return(-2);
if (in >= inend) { /* handle split mutli-byte characters */
break;
}
if (xmlLittleEndian) {
tmp = (unsigned char *) in;
d = *tmp++;
d = d << 8;
d = d | (unsigned int) *tmp;
d = (d << 8) | (unsigned int) *tmp;
in++;
} else {
d= *in++;
@ -1822,7 +1823,7 @@ xmlIconvWrapper(iconv_t cd, unsigned char *out, int *outlen,
size_t icv_inlen, icv_outlen;
const char *icv_in = (const char *) in;
char *icv_out = (char *) out;
int ret;
size_t ret;
if ((out == NULL) || (outlen == NULL) || (inlen == NULL) || (in == NULL)) {
if (outlen != NULL) *outlen = 0;
@ -1833,7 +1834,7 @@ xmlIconvWrapper(iconv_t cd, unsigned char *out, int *outlen,
ret = iconv(cd, (ICONV_CONST char **) &icv_in, &icv_inlen, &icv_out, &icv_outlen);
*inlen -= icv_inlen;
*outlen -= icv_outlen;
if ((icv_inlen != 0) || (ret == -1)) {
if ((icv_inlen != 0) || (ret == (size_t) -1)) {
#ifdef EILSEQ
if (errno == EILSEQ) {
return -2;
@ -2495,7 +2496,7 @@ retry:
*/
toconv = xmlBufUse(in);
if (toconv == 0)
return (0);
return (writtentot);
if (toconv > 64 * 1024)
toconv = 64 * 1024;
if (toconv * 4 >= written) {
@ -2629,7 +2630,6 @@ xmlCharEncOutFunc(xmlCharEncodingHandler *handler, xmlBufferPtr out,
int written;
int writtentot = 0;
int toconv;
int output = 0;
if (handler == NULL) return(-1);
if (out == NULL) return(-1);
@ -2682,8 +2682,6 @@ retry:
ret = -3;
}
if (ret >= 0) output += ret;
/*
* Attempt to handle error cases
*/

View file

@ -86,7 +86,7 @@ static unsigned long
xmlHashComputeKey(xmlHashTablePtr table, const xmlChar *name,
const xmlChar *name2, const xmlChar *name3) {
unsigned long value = 0L;
char ch;
unsigned long ch;
#ifdef HASH_RANDOMIZATION
value = table->random_seed;
@ -94,19 +94,19 @@ xmlHashComputeKey(xmlHashTablePtr table, const xmlChar *name,
if (name != NULL) {
value += 30 * (*name);
while ((ch = *name++) != 0) {
value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch);
value = value ^ ((value << 5) + (value >> 3) + ch);
}
}
value = value ^ ((value << 5) + (value >> 3));
if (name2 != NULL) {
while ((ch = *name2++) != 0) {
value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch);
value = value ^ ((value << 5) + (value >> 3) + ch);
}
}
value = value ^ ((value << 5) + (value >> 3));
if (name3 != NULL) {
while ((ch = *name3++) != 0) {
value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch);
value = value ^ ((value << 5) + (value >> 3) + ch);
}
}
return (value % table->size);
@ -121,7 +121,7 @@ xmlHashComputeQKey(xmlHashTablePtr table,
const xmlChar *prefix2, const xmlChar *name2,
const xmlChar *prefix3, const xmlChar *name3) {
unsigned long value = 0L;
char ch;
unsigned long ch;
#ifdef HASH_RANDOMIZATION
value = table->random_seed;
@ -133,37 +133,37 @@ xmlHashComputeQKey(xmlHashTablePtr table,
if (prefix != NULL) {
while ((ch = *prefix++) != 0) {
value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch);
value = value ^ ((value << 5) + (value >> 3) + ch);
}
value = value ^ ((value << 5) + (value >> 3) + (unsigned long)':');
}
if (name != NULL) {
while ((ch = *name++) != 0) {
value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch);
value = value ^ ((value << 5) + (value >> 3) + ch);
}
}
value = value ^ ((value << 5) + (value >> 3));
if (prefix2 != NULL) {
while ((ch = *prefix2++) != 0) {
value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch);
value = value ^ ((value << 5) + (value >> 3) + ch);
}
value = value ^ ((value << 5) + (value >> 3) + (unsigned long)':');
}
if (name2 != NULL) {
while ((ch = *name2++) != 0) {
value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch);
value = value ^ ((value << 5) + (value >> 3) + ch);
}
}
value = value ^ ((value << 5) + (value >> 3));
if (prefix3 != NULL) {
while ((ch = *prefix3++) != 0) {
value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch);
value = value ^ ((value << 5) + (value >> 3) + ch);
}
value = value ^ ((value << 5) + (value >> 3) + (unsigned long)':');
}
if (name3 != NULL) {
while ((ch = *name3++) != 0) {
value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch);
value = value ^ ((value << 5) + (value >> 3) + ch);
}
}
return (value % table->size);

View file

@ -2194,7 +2194,8 @@ xmlSkipBlankChars(xmlParserCtxtPtr ctxt) {
* It's Okay to use CUR/NEXT here since all the blanks are on
* the ASCII range.
*/
if (ctxt->instate != XML_PARSER_DTD) {
if (((ctxt->inputNr == 1) && (ctxt->instate != XML_PARSER_DTD)) ||
(ctxt->instate == XML_PARSER_START)) {
const xmlChar *cur;
/*
* if we are in the document content, go really fast
@ -4587,6 +4588,9 @@ xmlParseCharDataComplex(xmlParserCtxtPtr ctxt, int cdata) {
}
}
COPY_BUF(l,buf,nbchar,cur);
/* move current position before possible calling of ctxt->sax->characters */
NEXTL(l);
cur = CUR_CHAR(l);
if (nbchar >= XML_PARSER_BIG_BUFFER_SIZE) {
buf[nbchar] = 0;
@ -4620,8 +4624,6 @@ xmlParseCharDataComplex(xmlParserCtxtPtr ctxt, int cdata) {
if (ctxt->instate == XML_PARSER_EOF)
return;
}
NEXTL(l);
cur = CUR_CHAR(l);
}
if (nbchar != 0) {
buf[nbchar] = 0;
@ -4980,7 +4982,7 @@ get_more:
ctxt->input->cur = in;
in++;
ctxt->input->line++; ctxt->input->col = 1;
continue; /* while */
goto get_more;
}
in--;
}
@ -10657,16 +10659,16 @@ xmlParseXMLDecl(xmlParserCtxtPtr ctxt) {
void
xmlParseMisc(xmlParserCtxtPtr ctxt) {
while ((ctxt->instate != XML_PARSER_EOF) &&
(((RAW == '<') && (NXT(1) == '?')) ||
(CMP4(CUR_PTR, '<', '!', '-', '-')) ||
IS_BLANK_CH(CUR))) {
while (ctxt->instate != XML_PARSER_EOF) {
SKIP_BLANKS;
GROW;
if ((RAW == '<') && (NXT(1) == '?')) {
xmlParsePI(ctxt);
} else if (IS_BLANK_CH(CUR)) {
NEXT;
} else
} else if (CMP4(CUR_PTR, '<', '!', '-', '-')) {
xmlParseComment(ctxt);
} else {
break;
}
}
}
@ -10772,7 +10774,6 @@ xmlParseDocument(xmlParserCtxtPtr ctxt) {
/*
* The Misc part of the Prolog
*/
GROW;
xmlParseMisc(ctxt);
/*
@ -12625,6 +12626,7 @@ xmlCreateIOParserCtxt(xmlSAXHandlerPtr sax, void *user_data,
xmlFree(ctxt->sax);
ctxt->sax = (xmlSAXHandlerPtr) xmlMalloc(sizeof(xmlSAXHandler));
if (ctxt->sax == NULL) {
xmlFreeParserInputBuffer(buf);
xmlErrMemory(ctxt, NULL);
xmlFreeParserCtxt(ctxt);
return(NULL);
@ -14672,7 +14674,8 @@ xmlInitParser(void) {
return;
#if defined(_WIN32) && (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL))
atexit(xmlCleanupParser);
if (xmlFree == free)
atexit(xmlCleanupParser);
#endif
#ifdef LIBXML_THREAD_ENABLED

View file

@ -1546,8 +1546,10 @@ xmlNewInputFromFile(xmlParserCtxtPtr ctxt, const char *filename) {
}
inputStream = xmlNewInputStream(ctxt);
if (inputStream == NULL)
if (inputStream == NULL) {
xmlFreeParserInputBuffer(buf);
return(NULL);
}
inputStream->buf = buf;
inputStream = xmlCheckHTTPInput(ctxt, inputStream);

View file

@ -3654,6 +3654,7 @@ xmlRelaxNGParseData(xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr node)
def = xmlRelaxNGNewDefine(ctxt, node);
if (def == NULL) {
xmlFree(library);
xmlFree(type);
return (NULL);
}
@ -6838,6 +6839,7 @@ xmlRelaxNGNewDocParserCtxt(xmlDocPtr doc)
(xmlRelaxNGParserCtxtPtr) xmlMalloc(sizeof(xmlRelaxNGParserCtxt));
if (ret == NULL) {
xmlRngPErrMemory(NULL, "building parser\n");
xmlFreeDoc(copy);
return (NULL);
}
memset(ret, 0, sizeof(xmlRelaxNGParserCtxt));

View file

@ -1596,6 +1596,10 @@ xmlStringGetNodeList(const xmlDoc *doc, const xmlChar *value) {
*/
if (!xmlBufIsEmpty(buf)) {
node = xmlNewDocText(doc, NULL);
if (node == NULL) {
if (val != NULL) xmlFree(val);
goto out;
}
node->content = xmlBufDetach(buf);
if (last == NULL) {
@ -2852,8 +2856,15 @@ xmlSetTreeDoc(xmlNodePtr tree, xmlDocPtr doc) {
prop = prop->next;
}
}
if (tree->children != NULL)
if (tree->type == XML_ENTITY_REF_NODE) {
/*
* Clear 'children' which points to the entity declaration
* from the original document.
*/
tree->children = NULL;
} else if (tree->children != NULL) {
xmlSetListDoc(tree->children, doc);
}
tree->doc = doc;
}
}
@ -3691,17 +3702,14 @@ xmlFreeNodeList(xmlNodePtr cur) {
xmlFreeNsList((xmlNsPtr) cur);
return;
}
if ((cur->type == XML_DOCUMENT_NODE) ||
#ifdef LIBXML_DOCB_ENABLED
(cur->type == XML_DOCB_DOCUMENT_NODE) ||
#endif
(cur->type == XML_HTML_DOCUMENT_NODE)) {
xmlFreeDoc((xmlDocPtr) cur);
return;
}
if (cur->doc != NULL) dict = cur->doc->dict;
while (1) {
while ((cur->children != NULL) &&
(cur->type != XML_DOCUMENT_NODE) &&
#ifdef LIBXML_DOCB_ENABLED
(cur->type != XML_DOCB_DOCUMENT_NODE) &&
#endif
(cur->type != XML_HTML_DOCUMENT_NODE) &&
(cur->type != XML_DTD_NODE) &&
(cur->type != XML_ENTITY_REF_NODE)) {
cur = cur->children;
@ -3710,7 +3718,13 @@ xmlFreeNodeList(xmlNodePtr cur) {
next = cur->next;
parent = cur->parent;
if (cur->type != XML_DTD_NODE) {
if ((cur->type == XML_DOCUMENT_NODE) ||
#ifdef LIBXML_DOCB_ENABLED
(cur->type == XML_DOCB_DOCUMENT_NODE) ||
#endif
(cur->type == XML_HTML_DOCUMENT_NODE)) {
xmlFreeDoc((xmlDocPtr) cur);
} else if (cur->type != XML_DTD_NODE) {
if ((__xmlRegisterCallbacks) && (xmlDeregisterNodeDefaultValue))
xmlDeregisterNodeDefaultValue(cur);
@ -3724,11 +3738,6 @@ xmlFreeNodeList(xmlNodePtr cur) {
(cur->type != XML_XINCLUDE_START) &&
(cur->type != XML_XINCLUDE_END) &&
(cur->type != XML_ENTITY_REF_NODE) &&
(cur->type != XML_DOCUMENT_NODE) &&
#ifdef LIBXML_DOCB_ENABLED
(cur->type != XML_DOCB_DOCUMENT_NODE) &&
#endif
(cur->type != XML_HTML_DOCUMENT_NODE) &&
(cur->content != (xmlChar *) &(cur->properties))) {
DICT_FREE(cur->content)
}

View file

@ -1638,23 +1638,24 @@ xmlURIUnescapeString(const char *str, int len, char *target) {
out = ret;
while(len > 0) {
if ((len > 2) && (*in == '%') && (is_hex(in[1])) && (is_hex(in[2]))) {
int c = 0;
in++;
if ((*in >= '0') && (*in <= '9'))
*out = (*in - '0');
c = (*in - '0');
else if ((*in >= 'a') && (*in <= 'f'))
*out = (*in - 'a') + 10;
c = (*in - 'a') + 10;
else if ((*in >= 'A') && (*in <= 'F'))
*out = (*in - 'A') + 10;
c = (*in - 'A') + 10;
in++;
if ((*in >= '0') && (*in <= '9'))
*out = *out * 16 + (*in - '0');
c = c * 16 + (*in - '0');
else if ((*in >= 'a') && (*in <= 'f'))
*out = *out * 16 + (*in - 'a') + 10;
c = c * 16 + (*in - 'a') + 10;
else if ((*in >= 'A') && (*in <= 'F'))
*out = *out * 16 + (*in - 'A') + 10;
c = c * 16 + (*in - 'A') + 10;
in++;
len -= 3;
out++;
*out++ = (char) c;
} else {
*out++ = *in++;
len--;

View file

@ -479,6 +479,35 @@ nodeVPop(xmlValidCtxtPtr ctxt)
return (ret);
}
/**
* xmlValidNormalizeString:
* @str: a string
*
* Normalize a string in-place.
*/
static void
xmlValidNormalizeString(xmlChar *str) {
xmlChar *dst;
const xmlChar *src;
if (str == NULL)
return;
src = str;
dst = str;
while (*src == 0x20) src++;
while (*src != 0) {
if (*src == 0x20) {
while (*src == 0x20) src++;
if (*src != 0)
*dst++ = 0x20;
} else {
*dst++ = *src++;
}
}
*dst = 0;
}
#ifdef DEBUG_VALID_ALGO
static void
xmlValidPrintNode(xmlNodePtr cur) {
@ -2607,6 +2636,24 @@ xmlDumpNotationTable(xmlBufferPtr buf, xmlNotationTablePtr table) {
(xmlDictOwns(dict, (const xmlChar *)(str)) == 0))) \
xmlFree((char *)(str));
static int
xmlIsStreaming(xmlValidCtxtPtr ctxt) {
xmlParserCtxtPtr pctxt;
if (ctxt == NULL)
return(0);
/*
* These magic values are also abused to detect whether we're validating
* while parsing a document. In this case, userData points to the parser
* context.
*/
if ((ctxt->finishDtd != XML_CTXT_FINISH_DTD_0) &&
(ctxt->finishDtd != XML_CTXT_FINISH_DTD_1))
return(0);
pctxt = ctxt->userData;
return(pctxt->parseMode == XML_PARSE_READER);
}
/**
* xmlFreeID:
* @not: A id
@ -2650,7 +2697,7 @@ xmlAddID(xmlValidCtxtPtr ctxt, xmlDocPtr doc, const xmlChar *value,
if (doc == NULL) {
return(NULL);
}
if (value == NULL) {
if ((value == NULL) || (value[0] == 0)) {
return(NULL);
}
if (attr == NULL) {
@ -2681,7 +2728,7 @@ xmlAddID(xmlValidCtxtPtr ctxt, xmlDocPtr doc, const xmlChar *value,
*/
ret->value = xmlStrdup(value);
ret->doc = doc;
if ((ctxt != NULL) && (ctxt->vstateNr != 0)) {
if (xmlIsStreaming(ctxt)) {
/*
* Operating in streaming mode, attr is gonna disappear
*/
@ -2820,6 +2867,7 @@ xmlRemoveID(xmlDocPtr doc, xmlAttrPtr attr) {
ID = xmlNodeListGetString(doc, attr->children, 1);
if (ID == NULL)
return(-1);
xmlValidNormalizeString(ID);
id = xmlHashLookup(table, ID);
if (id == NULL || id->attr != attr) {
@ -3009,7 +3057,7 @@ xmlAddRef(xmlValidCtxtPtr ctxt, xmlDocPtr doc, const xmlChar *value,
* fill the structure.
*/
ret->value = xmlStrdup(value);
if ((ctxt != NULL) && (ctxt->vstateNr != 0)) {
if (xmlIsStreaming(ctxt)) {
/*
* Operating in streaming mode, attr is gonna disappear
*/
@ -4028,8 +4076,7 @@ xmlValidateAttributeValue2(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
xmlChar *
xmlValidCtxtNormalizeAttributeValue(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
xmlNodePtr elem, const xmlChar *name, const xmlChar *value) {
xmlChar *ret, *dst;
const xmlChar *src;
xmlChar *ret;
xmlAttributePtr attrDecl = NULL;
int extsubset = 0;
@ -4070,19 +4117,7 @@ xmlValidCtxtNormalizeAttributeValue(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
ret = xmlStrdup(value);
if (ret == NULL)
return(NULL);
src = value;
dst = ret;
while (*src == 0x20) src++;
while (*src != 0) {
if (*src == 0x20) {
while (*src == 0x20) src++;
if (*src != 0)
*dst++ = 0x20;
} else {
*dst++ = *src++;
}
}
*dst = 0;
xmlValidNormalizeString(ret);
if ((doc->standalone) && (extsubset == 1) && (!xmlStrEqual(value, ret))) {
xmlErrValidNode(ctxt, elem, XML_DTD_NOT_STANDALONE,
"standalone: %s on %s value had to be normalized based on external subset declaration\n",
@ -4114,8 +4149,7 @@ xmlValidCtxtNormalizeAttributeValue(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
xmlChar *
xmlValidNormalizeAttributeValue(xmlDocPtr doc, xmlNodePtr elem,
const xmlChar *name, const xmlChar *value) {
xmlChar *ret, *dst;
const xmlChar *src;
xmlChar *ret;
xmlAttributePtr attrDecl = NULL;
if (doc == NULL) return(NULL);
@ -4145,19 +4179,7 @@ xmlValidNormalizeAttributeValue(xmlDocPtr doc, xmlNodePtr elem,
ret = xmlStrdup(value);
if (ret == NULL)
return(NULL);
src = value;
dst = ret;
while (*src == 0x20) src++;
while (*src != 0) {
if (*src == 0x20) {
while (*src == 0x20) src++;
if (*src != 0)
*dst++ = 0x20;
} else {
*dst++ = *src++;
}
}
*dst = 0;
xmlValidNormalizeString(ret);
return(ret);
}

View file

@ -1014,15 +1014,15 @@ xmlXIncludeCopyRange(xmlXIncludeCtxtPtr ctxt, xmlDocPtr target,
if (list == NULL) {
list = tmp;
listParent = cur->parent;
last = tmp;
} else {
if (level == lastLevel)
xmlAddNextSibling(last, tmp);
last = xmlAddNextSibling(last, tmp);
else {
xmlAddChild(last, tmp);
last = xmlAddChild(last, tmp);
lastLevel = level;
}
}
last = tmp;
if (index2 > 1) {
end = xmlXIncludeGetNthChild(cur, index2 - 1);
@ -1103,12 +1103,11 @@ xmlXIncludeCopyRange(xmlXIncludeCtxtPtr ctxt, xmlDocPtr target,
}
if (tmp != NULL) {
if (level == lastLevel)
xmlAddNextSibling(last, tmp);
last = xmlAddNextSibling(last, tmp);
else {
xmlAddChild(last, tmp);
last = xmlAddChild(last, tmp);
lastLevel = level;
}
last = tmp;
}
}
/*
@ -1186,8 +1185,7 @@ xmlXIncludeCopyXPointer(xmlXIncludeCtxtPtr ctxt, xmlDocPtr target,
if (last == NULL) {
list = last = tmp;
} else {
xmlAddNextSibling(last, tmp);
last = tmp;
last = xmlAddNextSibling(last, tmp);
}
cur = cur->next;
continue;

View file

@ -2739,6 +2739,8 @@ __xmlOutputBufferCreateFilename(const char *URI,
ret->writecallback = xmlGzfileWrite;
ret->closecallback = xmlGzfileClose;
}
else
xmlGzfileClose(context);
return(ret);
}
}
@ -3405,12 +3407,18 @@ xmlOutputBufferWrite(xmlOutputBufferPtr out, int len, const char *buf) {
out->error = XML_IO_ENCODER;
return(-1);
}
nbchars = ret >= 0 ? ret : 0;
if (out->writecallback)
nbchars = xmlBufUse(out->conv);
else
nbchars = ret >= 0 ? ret : 0;
} else {
ret = xmlBufAdd(out->buffer, (const xmlChar *) buf, chunk);
if (ret != 0)
return(-1);
nbchars = chunk;
if (out->writecallback)
nbchars = xmlBufUse(out->buffer);
else
nbchars = chunk;
}
buf += chunk;
len -= chunk;
@ -3597,13 +3605,19 @@ xmlOutputBufferWriteEscape(xmlOutputBufferPtr out, const xmlChar *str,
out->error = XML_IO_ENCODER;
return(-1);
}
nbchars = ret >= 0 ? ret : 0;
if (out->writecallback)
nbchars = xmlBufUse(out->conv);
else
nbchars = ret >= 0 ? ret : 0;
} else {
ret = escaping(xmlBufEnd(out->buffer), &chunk, str, &cons);
if ((ret < 0) || (chunk == 0)) /* chunk==0 => nothing done */
return(-1);
xmlBufAddLen(out->buffer, chunk);
nbchars = chunk;
if (out->writecallback)
nbchars = xmlBufUse(out->buffer);
else
nbchars = chunk;
}
str += cons;
len -= cons;

View file

@ -214,32 +214,17 @@ static void usershell(void) {
}
}
} else if (!strcmp(command, "add")) {
if (sgml) {
if ((nbargs != 3) && (nbargs != 2)) {
printf("add requires 2 or 3 arguments\n");
} else {
if (argv[2] == NULL)
ret = xmlCatalogAdd(BAD_CAST argv[0], NULL,
BAD_CAST argv[1]);
else
ret = xmlCatalogAdd(BAD_CAST argv[0], BAD_CAST argv[1],
BAD_CAST argv[2]);
if (ret != 0)
printf("add command failed\n");
}
if ((nbargs != 3) && (nbargs != 2)) {
printf("add requires 2 or 3 arguments\n");
} else {
if ((nbargs != 3) && (nbargs != 2)) {
printf("add requires 2 or 3 arguments\n");
} else {
if (argv[2] == NULL)
ret = xmlCatalogAdd(BAD_CAST argv[0], NULL,
BAD_CAST argv[1]);
else
ret = xmlCatalogAdd(BAD_CAST argv[0], BAD_CAST argv[1],
BAD_CAST argv[2]);
if (ret != 0)
printf("add command failed\n");
}
if (argv[2] == NULL)
ret = xmlCatalogAdd(BAD_CAST argv[0], NULL,
BAD_CAST argv[1]);
else
ret = xmlCatalogAdd(BAD_CAST argv[0], BAD_CAST argv[1],
BAD_CAST argv[2]);
if (ret != 0)
printf("add command failed\n");
}
} else if (!strcmp(command, "del")) {
if (nbargs != 1) {

View file

@ -1659,6 +1659,11 @@ testSAX(const char *filename) {
xmlSchemaValidCtxtPtr vctxt;
vctxt = xmlSchemaNewValidCtxt(wxschemas);
if (vctxt == NULL) {
progresult = XMLLINT_ERR_MEM;
xmlFreeParserInputBuffer(buf);
goto error;
}
xmlSchemaSetValidErrors(vctxt, xmlGenericError, xmlGenericError, NULL);
xmlSchemaValidateSetFilename(vctxt, filename);
@ -1687,6 +1692,7 @@ testSAX(const char *filename) {
*/
ctxt = xmlNewParserCtxt();
if (ctxt == NULL) {
progresult = XMLLINT_ERR_MEM;
xmlFreeParserInputBuffer(buf);
goto error;
}
@ -2213,6 +2219,12 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
if (res > 0) {
ctxt = htmlCreatePushParserCtxt(NULL, NULL,
chars, res, filename, XML_CHAR_ENCODING_NONE);
if (ctxt == NULL) {
progresult = XMLLINT_ERR_MEM;
if (f != stdin)
fclose(f);
return;
}
htmlCtxtUseOptions(ctxt, options);
while ((res = fread(chars, 1, pushsize, f)) > 0) {
htmlParseChunk(ctxt, chars, res, 0);
@ -2221,7 +2233,8 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
doc = ctxt->myDoc;
htmlFreeParserCtxt(ctxt);
}
fclose(f);
if (f != stdin)
fclose(f);
}
}
#endif /* LIBXML_PUSH_ENABLED */
@ -2284,6 +2297,12 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
if (res > 0) {
ctxt = xmlCreatePushParserCtxt(NULL, NULL,
chars, res, filename);
if (ctxt == NULL) {
progresult = XMLLINT_ERR_MEM;
if (f != stdin)
fclose(f);
return;
}
xmlCtxtUseOptions(ctxt, options);
while ((res = fread(chars, 1, size, f)) > 0) {
xmlParseChunk(ctxt, chars, res, 0);
@ -2328,23 +2347,25 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
} else if (htmlout) {
xmlParserCtxtPtr ctxt;
if (rectxt == NULL)
if (rectxt == NULL) {
ctxt = xmlNewParserCtxt();
else
ctxt = rectxt;
if (ctxt == NULL) {
doc = NULL;
} else {
ctxt->sax->error = xmlHTMLError;
ctxt->sax->warning = xmlHTMLWarning;
ctxt->vctxt.error = xmlHTMLValidityError;
ctxt->vctxt.warning = xmlHTMLValidityWarning;
if (ctxt == NULL) {
progresult = XMLLINT_ERR_MEM;
return;
}
} else {
ctxt = rectxt;
}
doc = xmlCtxtReadFile(ctxt, filename, NULL, options);
ctxt->sax->error = xmlHTMLError;
ctxt->sax->warning = xmlHTMLWarning;
ctxt->vctxt.error = xmlHTMLValidityError;
ctxt->vctxt.warning = xmlHTMLValidityWarning;
if (rectxt == NULL)
xmlFreeParserCtxt(ctxt);
}
doc = xmlCtxtReadFile(ctxt, filename, NULL, options);
if (rectxt == NULL)
xmlFreeParserCtxt(ctxt);
#ifdef HAVE_MMAP
} else if (memory) {
int fd;
@ -2376,20 +2397,22 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
} else if (valid) {
xmlParserCtxtPtr ctxt = NULL;
if (rectxt == NULL)
if (rectxt == NULL) {
ctxt = xmlNewParserCtxt();
else
if (ctxt == NULL) {
progresult = XMLLINT_ERR_MEM;
return;
}
} else {
ctxt = rectxt;
if (ctxt == NULL) {
doc = NULL;
} else {
doc = xmlCtxtReadFile(ctxt, filename, NULL, options);
}
if (ctxt->valid == 0)
progresult = XMLLINT_ERR_RDFILE;
if (rectxt == NULL)
xmlFreeParserCtxt(ctxt);
}
doc = xmlCtxtReadFile(ctxt, filename, NULL, options);
if (ctxt->valid == 0)
progresult = XMLLINT_ERR_RDFILE;
if (rectxt == NULL)
xmlFreeParserCtxt(ctxt);
#endif /* LIBXML_VALID_ENABLED */
} else {
if (rectxt != NULL)
@ -2771,7 +2794,9 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
if ((cvp = xmlNewValidCtxt()) == NULL) {
xmlGenericError(xmlGenericErrorContext,
"Couldn't allocate validation context\n");
exit(-1);
progresult = XMLLINT_ERR_MEM;
xmlFreeDtd(dtd);
return;
}
cvp->userData = NULL;
cvp->error = xmlGenericError;
@ -2803,7 +2828,9 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
if ((cvp = xmlNewValidCtxt()) == NULL) {
xmlGenericError(xmlGenericErrorContext,
"Couldn't allocate validation context\n");
exit(-1);
progresult = XMLLINT_ERR_MEM;
xmlFreeDoc(doc);
return;
}
if ((timing) && (!repeat)) {
@ -2840,6 +2867,11 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
if (noout)
flag |= XML_SCHEMATRON_OUT_QUIET;
ctxt = xmlSchematronNewValidCtxt(wxschematron, flag);
if (ctxt == NULL) {
progresult = XMLLINT_ERR_MEM;
xmlFreeDoc(doc);
return;
}
#if 0
xmlSchematronSetValidErrors(ctxt, xmlGenericError, xmlGenericError,
NULL);
@ -2873,6 +2905,11 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
}
ctxt = xmlRelaxNGNewValidCtxt(relaxngschemas);
if (ctxt == NULL) {
progresult = XMLLINT_ERR_MEM;
xmlFreeDoc(doc);
return;
}
xmlRelaxNGSetValidErrors(ctxt, xmlGenericError, xmlGenericError, NULL);
ret = xmlRelaxNGValidateDoc(ctxt, doc);
if (ret == 0) {
@ -2900,6 +2937,11 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
}
ctxt = xmlSchemaNewValidCtxt(wxschemas);
if (ctxt == NULL) {
progresult = XMLLINT_ERR_MEM;
xmlFreeDoc(doc);
return;
}
xmlSchemaSetValidErrors(ctxt, xmlGenericError, xmlGenericError, NULL);
ret = xmlSchemaValidateDoc(ctxt, doc);
if (ret == 0) {
@ -3102,8 +3144,7 @@ static void usage(FILE *f, const char *name) {
fprintf(f, "\t--xpath expr: evaluate the XPath expression, imply --noout\n");
#endif
fprintf(f, "\nLibxml project home page: http://xmlsoft.org/\n");
fprintf(f, "To report bugs or get some help check: http://xmlsoft.org/bugs.html\n");
fprintf(f, "\nLibxml project home page: https://gitlab.gnome.org/GNOME/libxml2\n");
}
static void registerNode(xmlNodePtr node)
@ -3134,15 +3175,31 @@ main(int argc, char **argv) {
if (argc <= 1) {
usage(stderr, argv[0]);
return(1);
return(XMLLINT_ERR_UNCLASS);
}
LIBXML_TEST_VERSION
for (i = 1; i < argc ; i++) {
if (!strcmp(argv[i], "-"))
break;
/* xmlMemSetup must be called before initializing the parser. */
for (i = 1; i < argc ; i++) {
if (argv[i][0] != '-')
continue;
if ((!strcmp(argv[i], "-maxmem")) ||
(!strcmp(argv[i], "--maxmem"))) {
i++;
if ((i >= argc) || (sscanf(argv[i], "%d", &maxmem) != 1)) {
maxmem = 0;
}
}
}
if (maxmem != 0)
xmlMemSetup(myFreeFunc, myMallocFunc, myReallocFunc, myStrdupFunc);
LIBXML_TEST_VERSION
for (i = 1; i < argc ; i++) {
if (argv[i][0] != '-' || argv[i][1] == 0)
continue;
if ((!strcmp(argv[i], "-debug")) || (!strcmp(argv[i], "--debug")))
debug++;
else
@ -3382,12 +3439,6 @@ main(int argc, char **argv) {
else if ((!strcmp(argv[i], "-maxmem")) ||
(!strcmp(argv[i], "--maxmem"))) {
i++;
if (sscanf(argv[i], "%d", &maxmem) == 1) {
xmlMemSetup(myFreeFunc, myMallocFunc, myReallocFunc,
myStrdupFunc);
} else {
maxmem = 0;
}
}
else if ((!strcmp(argv[i], "-format")) ||
(!strcmp(argv[i], "--format"))) {
@ -3489,7 +3540,7 @@ main(int argc, char **argv) {
} else {
fprintf(stderr, "Unknown option %s\n", argv[i]);
usage(stderr, argv[0]);
return(1);
return(XMLLINT_ERR_UNCLASS);
}
}
@ -3566,6 +3617,10 @@ main(int argc, char **argv) {
startTimer();
}
ctxt = xmlSchematronNewParserCtxt(schematron);
if (ctxt == NULL) {
progresult = XMLLINT_ERR_MEM;
goto error;
}
#if 0
xmlSchematronSetParserErrors(ctxt, xmlGenericError, xmlGenericError,
NULL);
@ -3598,6 +3653,10 @@ main(int argc, char **argv) {
startTimer();
}
ctxt = xmlRelaxNGNewParserCtxt(relaxng);
if (ctxt == NULL) {
progresult = XMLLINT_ERR_MEM;
goto error;
}
xmlRelaxNGSetParserErrors(ctxt, xmlGenericError, xmlGenericError,
NULL);
relaxngschemas = xmlRelaxNGParse(ctxt);
@ -3622,6 +3681,10 @@ main(int argc, char **argv) {
startTimer();
}
ctxt = xmlSchemaNewParserCtxt(schema);
if (ctxt == NULL) {
progresult = XMLLINT_ERR_MEM;
goto error;
}
xmlSchemaSetParserErrors(ctxt, xmlGenericError, xmlGenericError, NULL);
wxschemas = xmlSchemaParse(ctxt);
if (wxschemas == NULL) {
@ -3772,6 +3835,7 @@ main(int argc, char **argv) {
}
if ((files == 0) && (!generate) && (version == 0)) {
usage(stderr, argv[0]);
progresult = XMLLINT_ERR_UNCLASS;
}
#ifdef LIBXML_SCHEMATRON_ENABLED
if (wxschematron != NULL)
@ -3788,6 +3852,8 @@ main(int argc, char **argv) {
if (patternc != NULL)
xmlFreePattern(patternc);
#endif
error:
xmlCleanupParser();
xmlMemoryDump();

View file

@ -78,7 +78,7 @@ void xmlMallocBreakpoint(void);
* Each of the blocks allocated begin with a header containing information
*/
#define MEMTAG 0x5aa5
#define MEMTAG 0x5aa5U
#define MALLOC_TYPE 1
#define REALLOC_TYPE 2

View file

@ -1892,6 +1892,12 @@ xmlFAReduceEpsilonTransitions(xmlRegParserCtxtPtr ctxt, int fromnr,
* then X and Y are semantically equivalent and X can be eliminated
* If X is the start state then make Y the start state, else replace the
* target of all transitions to X by transitions to Y.
*
* If X is a final state, skip it.
* Otherwise it would be necessary to manipulate counters for this case when
* eliminating state 2:
* State 1 has a transition with an atom to state 2.
* State 2 is final and has an epsilon transition to state 1.
*/
static void
xmlFAEliminateSimpleEpsilonTransitions(xmlRegParserCtxtPtr ctxt) {
@ -1904,7 +1910,8 @@ xmlFAEliminateSimpleEpsilonTransitions(xmlRegParserCtxtPtr ctxt) {
continue;
if (state->nbTrans != 1)
continue;
if (state->type == XML_REGEXP_UNREACH_STATE)
if (state->type == XML_REGEXP_UNREACH_STATE ||
state->type == XML_REGEXP_FINAL_STATE)
continue;
/* is the only transition out a basic transition */
if ((state->trans[0].atom == NULL) &&

View file

@ -847,7 +847,7 @@ htmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) {
static void
xmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) {
int format = ctxt->format;
xmlNodePtr tmp, root, unformattedNode = NULL;
xmlNodePtr tmp, root, unformattedNode = NULL, parent;
xmlAttrPtr attr;
xmlChar *start, *end;
xmlOutputBufferPtr buf;
@ -856,6 +856,7 @@ xmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) {
buf = ctxt->buf;
root = cur;
parent = cur->parent;
while (1) {
switch (cur->type) {
case XML_DOCUMENT_NODE:
@ -868,7 +869,9 @@ xmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) {
break;
case XML_DOCUMENT_FRAG_NODE:
if (cur->children != NULL) {
/* Always validate cur->parent when descending. */
if ((cur->parent == parent) && (cur->children != NULL)) {
parent = cur;
cur = cur->children;
continue;
}
@ -887,12 +890,23 @@ xmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) {
break;
case XML_ELEMENT_NODE:
if ((cur != root) && (ctxt->format == 1) && (xmlIndentTreeOutput))
if ((cur != root) && (ctxt->format == 1) &&
(xmlIndentTreeOutput))
xmlOutputBufferWrite(buf, ctxt->indent_size *
(ctxt->level > ctxt->indent_nr ?
ctxt->indent_nr : ctxt->level),
ctxt->indent);
/*
* Some users like lxml are known to pass nodes with a corrupted
* tree structure. Fall back to a recursive call to handle this
* case.
*/
if ((cur->parent != parent) && (cur->children != NULL)) {
xmlNodeDumpOutputInternal(ctxt, cur);
break;
}
xmlOutputBufferWrite(buf, 1, "<");
if ((cur->ns != NULL) && (cur->ns->prefix != NULL)) {
xmlOutputBufferWriteString(buf, (const char *)cur->ns->prefix);
@ -942,6 +956,7 @@ xmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) {
xmlOutputBufferWrite(buf, 1, ">");
if (ctxt->format == 1) xmlOutputBufferWrite(buf, 1, "\n");
if (ctxt->level >= 0) ctxt->level++;
parent = cur;
cur = cur->children;
continue;
}
@ -1058,13 +1073,9 @@ xmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) {
break;
}
/*
* The parent should never be NULL here but we want to handle
* corrupted documents gracefully.
*/
if (cur->parent == NULL)
return;
cur = cur->parent;
cur = parent;
/* cur->parent was validated when descending. */
parent = cur->parent;
if (cur->type == XML_ELEMENT_NODE) {
if (ctxt->level > 0) ctxt->level--;

View file

@ -1342,6 +1342,9 @@ xmlSchemaFormatQNameNs(xmlChar **buf, xmlNsPtr ns, const xmlChar *localName)
static const xmlChar *
xmlSchemaGetComponentName(xmlSchemaBasicItemPtr item)
{
if (item == NULL) {
return (NULL);
}
switch (item->type) {
case XML_SCHEMA_TYPE_ELEMENT:
return (((xmlSchemaElementPtr) item)->name);
@ -1397,6 +1400,9 @@ xmlSchemaGetQNameRefTargetNs(void *ref)
static const xmlChar *
xmlSchemaGetComponentTargetNs(xmlSchemaBasicItemPtr item)
{
if (item == NULL) {
return (NULL);
}
switch (item->type) {
case XML_SCHEMA_TYPE_ELEMENT:
return (((xmlSchemaElementPtr) item)->targetNamespace);
@ -5893,7 +5899,7 @@ xmlSchemaPValAttrNodeQNameValue(xmlSchemaParserCtxtPtr ctxt,
if (!strchr((char *) value, ':')) {
ns = xmlSearchNs(attr->doc, attr->parent, NULL);
if (ns)
if (ns && ns->href && ns->href[0])
*uri = xmlDictLookup(ctxt->dict, ns->href, -1);
else if (schema->flags & XML_SCHEMAS_INCLUDING_CONVERT_NS) {
/* TODO: move XML_SCHEMAS_INCLUDING_CONVERT_NS to the
@ -28136,10 +28142,6 @@ xmlSchemaVDocWalk(xmlSchemaValidCtxtPtr vctxt)
VERROR(1, NULL, "The document has no document element");
return (1);
}
for (node = valRoot->next; node != NULL; node = node->next) {
if (node->type == XML_ELEMENT_NODE)
VERROR(1, NULL, "The document has more than one top element");
}
vctxt->depth = -1;
vctxt->validationRoot = valRoot;
node = valRoot;

View file

@ -5431,7 +5431,6 @@ xmlSchemaValidateFacetInternal(xmlSchemaFacetPtr facet,
xmlSchemaWhitespaceValueType ws)
{
int ret;
int stringType;
if (facet == NULL)
return(-1);
@ -5449,10 +5448,16 @@ xmlSchemaValidateFacetInternal(xmlSchemaFacetPtr facet,
* the datatype.
* See https://www.w3.org/TR/xmlschema-2/#rf-pattern
*/
stringType = val && ((val->type >= XML_SCHEMAS_STRING && val->type <= XML_SCHEMAS_NORMSTRING)
|| (val->type >= XML_SCHEMAS_TOKEN && val->type <= XML_SCHEMAS_NCNAME));
ret = xmlRegexpExec(facet->regexp,
(stringType && val->value.str) ? val->value.str : value);
if (val &&
val->value.str &&
((val->type >= XML_SCHEMAS_STRING &&
val->type <= XML_SCHEMAS_NORMSTRING) ||
(val->type >= XML_SCHEMAS_TOKEN &&
val->type <= XML_SCHEMAS_ENTITIES &&
val->type != XML_SCHEMAS_QNAME))) {
value = val->value.str;
}
ret = xmlRegexpExec(facet->regexp, value);
if (ret == 1)
return(0);
if (ret == 0)

View file

@ -18,6 +18,7 @@
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <libxml/xmlmemory.h>
#include <libxml/parserInternals.h>
#include <libxml/xmlstring.h>
@ -42,7 +43,7 @@ xmlStrndup(const xmlChar *cur, int len) {
xmlChar *ret;
if ((cur == NULL) || (len < 0)) return(NULL);
ret = (xmlChar *) xmlMallocAtomic((len + 1) * sizeof(xmlChar));
ret = (xmlChar *) xmlMallocAtomic(((size_t) len + 1) * sizeof(xmlChar));
if (ret == NULL) {
xmlErrMemory(NULL, NULL);
return(NULL);
@ -87,7 +88,7 @@ xmlCharStrndup(const char *cur, int len) {
xmlChar *ret;
if ((cur == NULL) || (len < 0)) return(NULL);
ret = (xmlChar *) xmlMallocAtomic((len + 1) * sizeof(xmlChar));
ret = (xmlChar *) xmlMallocAtomic(((size_t) len + 1) * sizeof(xmlChar));
if (ret == NULL) {
xmlErrMemory(NULL, NULL);
return(NULL);
@ -423,14 +424,14 @@ xmlStrsub(const xmlChar *str, int start, int len) {
int
xmlStrlen(const xmlChar *str) {
int len = 0;
size_t len = 0;
if (str == NULL) return(0);
while (*str != 0) { /* non input consuming */
str++;
len++;
}
return(len);
return(len > INT_MAX ? 0 : len);
}
/**
@ -460,9 +461,9 @@ xmlStrncat(xmlChar *cur, const xmlChar *add, int len) {
return(xmlStrndup(add, len));
size = xmlStrlen(cur);
if (size < 0)
if ((size < 0) || (size > INT_MAX - len))
return(NULL);
ret = (xmlChar *) xmlRealloc(cur, (size + len + 1) * sizeof(xmlChar));
ret = (xmlChar *) xmlRealloc(cur, ((size_t) size + len + 1) * sizeof(xmlChar));
if (ret == NULL) {
xmlErrMemory(NULL, NULL);
return(cur);
@ -500,9 +501,9 @@ xmlStrncatNew(const xmlChar *str1, const xmlChar *str2, int len) {
return(xmlStrndup(str2, len));
size = xmlStrlen(str1);
if (size < 0)
if ((size < 0) || (size > INT_MAX - len))
return(NULL);
ret = (xmlChar *) xmlMalloc((size + len + 1) * sizeof(xmlChar));
ret = (xmlChar *) xmlMalloc(((size_t) size + len + 1) * sizeof(xmlChar));
if (ret == NULL) {
xmlErrMemory(NULL, NULL);
return(xmlStrndup(str1, size));
@ -667,7 +668,7 @@ xmlUTF8Charcmp(const xmlChar *utf1, const xmlChar *utf2) {
*/
int
xmlUTF8Strlen(const xmlChar *utf) {
int ret = 0;
size_t ret = 0;
if (utf == NULL)
return(-1);
@ -694,7 +695,7 @@ xmlUTF8Strlen(const xmlChar *utf) {
}
ret++;
}
return(ret);
return(ret > INT_MAX ? 0 : ret);
}
/**
@ -796,26 +797,28 @@ xmlCheckUTF8(const unsigned char *utf)
* 1110xxxx 10xxxxxx 10xxxxxx valid 3-byte
* 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx valid 4-byte
*/
for (ix = 0; (c = utf[ix]);) { /* string is 0-terminated */
while ((c = utf[0])) { /* string is 0-terminated */
ix = 0;
if ((c & 0x80) == 0x00) { /* 1-byte code, starts with 10 */
ix++;
ix = 1;
} else if ((c & 0xe0) == 0xc0) {/* 2-byte code, starts with 110 */
if ((utf[ix+1] & 0xc0 ) != 0x80)
if ((utf[1] & 0xc0 ) != 0x80)
return 0;
ix += 2;
ix = 2;
} else if ((c & 0xf0) == 0xe0) {/* 3-byte code, starts with 1110 */
if (((utf[ix+1] & 0xc0) != 0x80) ||
((utf[ix+2] & 0xc0) != 0x80))
if (((utf[1] & 0xc0) != 0x80) ||
((utf[2] & 0xc0) != 0x80))
return 0;
ix += 3;
ix = 3;
} else if ((c & 0xf8) == 0xf0) {/* 4-byte code, starts with 11110 */
if (((utf[ix+1] & 0xc0) != 0x80) ||
((utf[ix+2] & 0xc0) != 0x80) ||
((utf[ix+3] & 0xc0) != 0x80))
if (((utf[1] & 0xc0) != 0x80) ||
((utf[2] & 0xc0) != 0x80) ||
((utf[3] & 0xc0) != 0x80))
return 0;
ix += 4;
ix = 4;
} else /* unknown encoding */
return 0;
utf += ix;
}
return(1);
}
@ -834,8 +837,9 @@ xmlCheckUTF8(const unsigned char *utf)
int
xmlUTF8Strsize(const xmlChar *utf, int len) {
const xmlChar *ptr=utf;
xmlChar ch;
const xmlChar *ptr=utf;
int ch;
size_t ret;
if (utf == NULL)
return(0);
@ -852,7 +856,8 @@ xmlUTF8Strsize(const xmlChar *utf, int len) {
ptr++;
}
}
return (ptr - utf);
ret = ptr - utf;
return (ret > INT_MAX ? 0 : ret);
}
@ -872,11 +877,8 @@ xmlUTF8Strndup(const xmlChar *utf, int len) {
if ((utf == NULL) || (len < 0)) return(NULL);
i = xmlUTF8Strsize(utf, len);
ret = (xmlChar *) xmlMallocAtomic((i + 1) * sizeof(xmlChar));
ret = (xmlChar *) xmlMallocAtomic(((size_t) i + 1) * sizeof(xmlChar));
if (ret == NULL) {
xmlGenericError(xmlGenericErrorContext,
"malloc of %ld byte failed\n",
(len + 1) * (long)sizeof(xmlChar));
return(NULL);
}
memcpy(ret, utf, i * sizeof(xmlChar));
@ -896,7 +898,7 @@ xmlUTF8Strndup(const xmlChar *utf, int len) {
*/
const xmlChar *
xmlUTF8Strpos(const xmlChar *utf, int pos) {
xmlChar ch;
int ch;
if (utf == NULL) return(NULL);
if (pos < 0)
@ -928,14 +930,15 @@ xmlUTF8Strpos(const xmlChar *utf, int pos) {
*/
int
xmlUTF8Strloc(const xmlChar *utf, const xmlChar *utfchar) {
int i, size;
xmlChar ch;
size_t i;
int size;
int ch;
if (utf==NULL || utfchar==NULL) return -1;
size = xmlUTF8Strsize(utfchar, 1);
for(i=0; (ch=*utf) != 0; i++) {
if (xmlStrncmp(utf, utfchar, size)==0)
return(i);
return(i > INT_MAX ? 0 : i);
utf++;
if ( ch & 0x80 ) {
/* if not simple ascii, verify proper format */
@ -965,8 +968,8 @@ xmlUTF8Strloc(const xmlChar *utf, const xmlChar *utfchar) {
xmlChar *
xmlUTF8Strsub(const xmlChar *utf, int start, int len) {
int i;
xmlChar ch;
int i;
int ch;
if (utf == NULL) return(NULL);
if (start < 0) return(NULL);
@ -1022,6 +1025,8 @@ xmlEscapeFormatString(xmlChar **msg)
if (count == 0)
return(*msg);
if ((count > INT_MAX) || (msgLen > INT_MAX - count))
return(NULL);
resultLen = msgLen + count + 1;
result = (xmlChar *) xmlMallocAtomic(resultLen * sizeof(xmlChar));
if (result == NULL) {

View file

@ -10983,7 +10983,7 @@ xmlXPathCompileExpr(xmlXPathParserContextPtr ctxt, int sort) {
}
if (xpctxt != NULL)
xpctxt->depth -= 1;
xpctxt->depth -= 10;
}
/**
@ -11120,7 +11120,9 @@ xmlXPathCompNodeTest(xmlXPathParserContextPtr ctxt, xmlXPathTestVal *test,
name = NULL;
if (CUR != ')') {
name = xmlXPathParseLiteral(ctxt);
CHECK_ERROR NULL;
if (name == NULL) {
XP_ERRORNULL(XPATH_EXPR_ERROR);
}
*test = NODE_TEST_PI;
SKIP_BLANKS;
}

View file

@ -851,7 +851,6 @@ static void xmlXPtrEvalChildSeq(xmlXPathParserContextPtr ctxt, xmlChar *name);
*
* Dirty macros, i.e. one need to make assumption on the context to use them
*
* CUR_PTR return the current pointer to the xmlChar to be parsed.
* CUR returns the current xmlChar value, i.e. a 8 bit value
* in ISO-Latin or UTF-8.
* This should be used internally by the parser
@ -871,7 +870,6 @@ static void xmlXPtrEvalChildSeq(xmlXPathParserContextPtr ctxt, xmlChar *name);
#define CUR (*ctxt->cur)
#define SKIP(val) ctxt->cur += (val)
#define NXT(val) ctxt->cur[(val)]
#define CUR_PTR ctxt->cur
#define SKIP_BLANKS \
while (IS_BLANK_CH(*(ctxt->cur))) NEXT
@ -999,9 +997,10 @@ xmlXPtrEvalXPtrPart(xmlXPathParserContextPtr ctxt, xmlChar *name) {
}
if (xmlStrEqual(name, (xmlChar *) "xpointer")) {
const xmlChar *left = CUR_PTR;
const xmlChar *oldBase = ctxt->base;
const xmlChar *oldCur = ctxt->cur;
CUR_PTR = buffer;
ctxt->cur = ctxt->base = buffer;
/*
* To evaluate an xpointer scheme element (4.3) we need:
* context initialized to the root
@ -1012,42 +1011,49 @@ xmlXPtrEvalXPtrPart(xmlXPathParserContextPtr ctxt, xmlChar *name) {
ctxt->context->proximityPosition = 1;
ctxt->context->contextSize = 1;
xmlXPathEvalExpr(ctxt);
CUR_PTR=left;
ctxt->base = oldBase;
ctxt->cur = oldCur;
} else if (xmlStrEqual(name, (xmlChar *) "element")) {
const xmlChar *left = CUR_PTR;
const xmlChar *oldBase = ctxt->base;
const xmlChar *oldCur = ctxt->cur;
xmlChar *name2;
CUR_PTR = buffer;
ctxt->cur = ctxt->base = buffer;
if (buffer[0] == '/') {
xmlXPathRoot(ctxt);
xmlXPtrEvalChildSeq(ctxt, NULL);
} else {
name2 = xmlXPathParseName(ctxt);
if (name2 == NULL) {
CUR_PTR = left;
ctxt->base = oldBase;
ctxt->cur = oldCur;
xmlFree(buffer);
xmlFree(name);
XP_ERROR(XPATH_EXPR_ERROR);
}
xmlXPtrEvalChildSeq(ctxt, name2);
}
CUR_PTR = left;
ctxt->base = oldBase;
ctxt->cur = oldCur;
#ifdef XPTR_XMLNS_SCHEME
} else if (xmlStrEqual(name, (xmlChar *) "xmlns")) {
const xmlChar *left = CUR_PTR;
const xmlChar *oldBase = ctxt->base;
const xmlChar *oldCur = ctxt->cur;
xmlChar *prefix;
xmlChar *URI;
xmlURIPtr value;
CUR_PTR = buffer;
ctxt->cur = ctxt->base = buffer;
prefix = xmlXPathParseNCName(ctxt);
if (prefix == NULL) {
ctxt->base = oldBase;
ctxt->cur = oldCur;
xmlFree(buffer);
xmlFree(name);
XP_ERROR(XPTR_SYNTAX_ERROR);
}
SKIP_BLANKS;
if (CUR != '=') {
ctxt->base = oldBase;
ctxt->cur = oldCur;
xmlFree(prefix);
xmlFree(buffer);
xmlFree(name);
@ -1055,27 +1061,10 @@ xmlXPtrEvalXPtrPart(xmlXPathParserContextPtr ctxt, xmlChar *name) {
}
NEXT;
SKIP_BLANKS;
/* @@ check escaping in the XPointer WD */
value = xmlParseURI((const char *)ctxt->cur);
if (value == NULL) {
xmlFree(prefix);
xmlFree(buffer);
xmlFree(name);
XP_ERROR(XPTR_SYNTAX_ERROR);
}
URI = xmlSaveUri(value);
xmlFreeURI(value);
if (URI == NULL) {
xmlFree(prefix);
xmlFree(buffer);
xmlFree(name);
XP_ERROR(XPATH_MEMORY_ERROR);
}
xmlXPathRegisterNs(ctxt->context, prefix, URI);
CUR_PTR = left;
xmlFree(URI);
xmlXPathRegisterNs(ctxt->context, prefix, ctxt->cur);
ctxt->base = oldBase;
ctxt->cur = oldCur;
xmlFree(prefix);
#endif /* XPTR_XMLNS_SCHEME */
} else {
@ -1470,16 +1459,16 @@ xmlXPtrBuildRangeNodeList(xmlXPathObjectPtr range) {
return(list);
} else {
tmp = xmlCopyNode(cur, 0);
if (list == NULL)
if (list == NULL) {
list = tmp;
else {
parent = tmp;
} else {
if (last != NULL)
xmlAddNextSibling(last, tmp);
parent = xmlAddNextSibling(last, tmp);
else
xmlAddChild(parent, tmp);
parent = xmlAddChild(parent, tmp);
}
last = NULL;
parent = tmp;
if (index2 > 1) {
end = xmlXPtrGetNthChild(cur, index2 - 1);
@ -1561,8 +1550,7 @@ xmlXPtrBuildRangeNodeList(xmlXPathObjectPtr range) {
if (last != NULL)
xmlAddNextSibling(last, tmp);
else {
xmlAddChild(parent, tmp);
last = tmp;
last = xmlAddChild(parent, tmp);
}
}
}