summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Generate devhelp2 index filedevhelp2-indexEmmanuele Bassi2021-07-233-1/+3714
| | | | | | | The devhelp2 format was introduced in 2005, and the devhelp format was deprecated in 2017. Fixes: https://gitlab.gnome.org/GNOME/libxml2/-/issues/295
* Patch to forbid epsilon-reduction of final statesArne Becker2021-07-061-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | When building the internal representation of a regexp, it is possible that a lot of empty transitions are created. Therefore there is a step to reduce them in the function xmlFAEliminateSimpleEpsilonTransitions. There is an error there for this case: * State 1 has a transition with an atom (in this case "a") to state 2. * State 2 is final and has an epsilon transition to state 1. After reduction it looked like: * State 1 has a transition with an atom (in this case "a") to itself and is final. In other words, the empty string is accepted when it shouldn't be. The attached patch skips the reduction step for final states. An alternative would be to insert or increment counters when reducing a final state, but this seemed error prone and unnecessary, since there aren't that many final states. Fixes #282
* Use version in configure.ac for CMakeTimothy Lyanguzov2021-06-071-6/+11
| | | | Now CMake script reads version from configure.ac to prevent unsynchronized versions
* Fix whitespace when serializing empty HTML documentsNick Wellnhofer2021-06-071-5/+9
| | | | | | | | | The old, non-recursive HTML serialization code would always terminate the output with a newline. The new implementation omitted the newline if the document node had no children. Readd the newline when serializing empty documents. Fixes #266.
* Fix XPath recursion limitNick Wellnhofer2021-06-021-1/+1
| | | | | | | | | Fix accounting of recursion depth when parsing XPath expressions. This silly bug introduced in commit 804c5297 could lead to spurious errors when parsing larger expressions or XSLT documents. Should fix #264.
* Fix regression in xmlNodeDumpOutputInternalNick Wellnhofer2021-05-251-7/+7
| | | | | Commit 85b1792e could cause additional whitespace if xmlNodeDump was called with a non-zero starting level.
* Update CMake project versionMarkus Rickert2021-05-231-1/+1
|
* Add CMake alias targets for embedded projectsMarkus Rickert2021-05-231-0/+2
|
* Fix some validation errors in the FAQDavid King2021-05-232-16/+12
| | | | Move paragraphs inside li elements.
* Remove unused variable in xmlCharEncOutFuncDavid King2021-05-231-3/+0
| | | | | | | | | | Fixes a compiler warning: encoding.c: In function 'xmlCharEncOutFunc__internal_alias': encoding.c:2632:9: warning: unused variable 'output' [-Wunused-variable] 2632 | int output = 0; https://gitlab.gnome.org/GNOME/libxml2/-/issues/254
* Add missing file xmlwin32version.h.in to EXTRA_DISTMarkus Rickert2021-05-211-1/+1
|
* Add instructions on how to use CMake to compile libxmlMarkus Rickert2021-05-211-0/+20
|
* Work around lxml API abuseNick Wellnhofer2021-05-212-28/+49
| | | | | | | | | | | | Make xmlNodeDumpOutput and htmlNodeDumpFormatOutput work with corrupted parent pointers. This used to work with the old recursive code but the non-recursive rewrite required parent pointers to be set correctly. Unfortunately, lxml relies on the old behavior and passes subtrees with a corrupted structure. Fall back to a recursive function call if an invalid parent pointer is detected. Fixes #255.
* fix: avoid segfault at exit when using custom memory functionsMike Dalessio2021-05-201-1/+2
| | | | | | | This extends the fix introduced by 956534e to Windows processes dynamically loading libxml2. Closes #256.
* Release of libxml2-2.9.12v2.9.12Daniel Veillard2021-05-132-2/+2
| | | | | | | Brown paper bag release, some recently added sources were missing from the 2.9.11 tarball: - configure.ac: bump version - fuzz/Makefile.am: add fuzz.h and seed/regexp to EXTRA_DIST
* Release of libxml2-2.9.11v2.9.11Daniel Veillard2021-05-1379-483/+1061
| | | | | | | Prompted by CVE-2021-3541, but this includes an awful lot of serious bug fixes by Nick and others. - configure.ac: bumped to new release - doc/* updated and regenerated
* Patch for security issue CVE-2021-3541CVE-2021-3541Daniel Veillard2021-05-131-0/+26
| | | | | | | This is relapted to parameter entities expansion and following the line of the billion laugh attack. Somehow in that path the counting of parameters was missed and the normal algorithm based on entities "density" was useless.
* Fix null deref in legacy SAX1 parserNick Wellnhofer2021-05-091-13/+2
| | | | | | | | | | | | Always call nameNsPush instead of namePush. The latter is unused now and should probably be removed from the public API. I can't see how it could be used reasonably from client code and the unprefixed name has always polluted the global namespace. Fixes a null pointer dereference introduced with de5b624f when parsing in SAX1 mode. Found by OSS-Fuzz.
* Store per-element parser state in a structNick Wellnhofer2021-05-082-52/+35
| | | | | | | | | | | | | Make the parser context's "pushTab" point to an array of structs instead of void pointers. This avoids casting unrelated types to void pointers, improving readability and portability, and allows for more efficient packing. Ultimately, the struct could be extended to include the contents of "nameTab" and "spaceTab", further simplifying the code. Historically, "pushTab" was only used by the push parser (hence the name), so the change to the public headers should be safe. Also remove an unused parameter from xmlParseEndTag2.
* Fix handling of unexpected EOF in xmlParseContentNick Wellnhofer2021-05-084-11/+45
| | | | | | | | Readd the XML_ERR_TAG_NOT_FINISHED error on unexpected EOF which was removed in commit 62150ed2. This commit also introduced a regression for direct users of xmlParseContent. Unclosed tags weren't checked.
* Fix line numbers in error messages for mismatched tagsNick Wellnhofer2021-05-074-20/+28
| | | | | | | | | Commit 62150ed2 introduced a small regression in the error messages for mismatched tags. This typically only affected messages after the first mismatch, but with custom SAX handlers all line numbers would be off. This also fixes line numbers in the SAX push parser which were never handled correctly.
* Fix htmlTagLookupNick Wellnhofer2021-05-061-2/+2
| | | | | | | | Fix regression introduced with b25acce8. Some users like libxslt may call the HTML output functions on documents with uppercase tag names, so we must keep case-insensitive string comparison. Fixes #248.
* update for xsd:language type checkPaulHiggs2021-05-031-1/+40
| | | | Fixes #242.
* Propagate error in xmlParseElementChildrenContentDeclPrivNick Wellnhofer2021-05-011-0/+7
| | | | | | | | | | Check return value of recursive calls to xmlParseElementChildrenContentDeclPriv and return immediately in case of errors. Otherwise, struct xmlElementContent could contain unexpected null pointers, leading to a null deref when post-validating documents which aren't well-formed and parsed in recovery mode. Fixes #243.
* Update INSTALL.libxml2Nick Wellnhofer2021-04-251-34/+24
| | | | Fixes #238.
* Fix user-after-free with `xmllint --xinclude --dropdtd`Nick Wellnhofer2021-04-221-3/+2
| | | | | | | | | | | | | The --dropdtd option can leave dangling pointers in entity reference nodes. Make sure to skip these nodes when processing XIncludes. This also avoids scanning entity declarations and even modifying them inadvertently during XInclude processing. Move from a block list to an allow list approach to avoid descending into other node types that can't contain elements. Fixes #237.
* Fix dangling pointer with `xmllint --dropdtd`Nick Wellnhofer2021-04-221-0/+1
| | | | Reset doc->intSubset when dropping the DTD.
* Validate UTF8 in xmlEncodeEntitiesJoel Hockey2021-04-221-1/+15
| | | | | | | | | Code is currently assuming UTF-8 without validating. Truncated UTF-8 input can cause out-of-bounds array access. Adds further checks to partial fix in 50f06b3e. Fixes #178
* Fix use-after-free with `xmllint --html --push`Nick Wellnhofer2021-04-211-1/+1
| | | | | | | | | Call htmlCtxtUseOptions to make sure that names aren't stored in dictionaries. Note that this issue only affects xmllint using the HTML push parser. Fixes #230.
* Fix include order in c14n.hNick Wellnhofer2021-03-201-4/+6
| | | | | | | - Include xmlversion.h before testing feature flags. - Include libxml headers before extern "C". Fixes #226.
* CMake: Only add postfixes if MSVCChristopher Degawa2021-03-161-1/+1
| | | | | | | Currently, it catches mingw-w64 in there as well, but mingw-w64 follows linux-like naming with no weird postfixes Signed-off-by: Christopher Degawa <ccom@randomderp.com>
* Allow FP division by zero in xmlXPathInitNick Wellnhofer2021-03-161-0/+1
|
* Fix XPath NaN/Inf for older GCC versionsNick Wellnhofer2021-03-131-23/+17
| | | | | | The DBL_MAX approach could lead to errors caused by excess precision. Switch back to the division-by-zero approach with a work-around for MSVC and use the extern globals instead of macro expressions.
* Fix xmlGetNodePath with invalid node typesNick Wellnhofer2021-03-131-1/+3
| | | | | | | | | | | Make xmlGetNodePath return NULL instead of invalid XPath when hitting unsupported node types like DTD content. Reported here: https://mail.gnome.org/archives/xml/2021-January/msg00012.html Original report: https://bugs.php.net/bug.php?id=80680
* Fix exponential behavior with recursive entitiesNick Wellnhofer2021-03-131-2/+7
| | | | | | | | | | Fix another case where only recursion depth was limited, but entities would still be expanded over and over again. The test case discovered by fuzzing only affected parsing in recovery mode with XML_PARSE_RECOVER. Found by OSS-Fuzz.
* Fix duplicate xmlStrEqual calls in htmlParseEndTagNick Wellnhofer2021-03-041-6/+4
|
* Speed up htmlCheckAutoCloseNick Wellnhofer2021-03-041-136/+280
| | | | Switch to binary search.
* Speed up htmlTagLookupNick Wellnhofer2021-03-041-7/+13
| | | | | | Switch to binary search. This is the first time bsearch is used in the libxml2 code base. But it's a standard library function since C89 and should be portable.
* Clarify xmlNewDocProp documentationNick Wellnhofer2021-03-021-0/+5
|
* Stop checking attributes for UTF-8 validityNick Wellnhofer2021-03-021-12/+0
| | | | | | | | | | | | | | | I can't see a reason to check attribute content for UTF-8 validity. Other parts of the API like xmlNewText have always assumed valid UTF-8 as extra checks only slow down processing. Besides, setting doc->encoding to "ISO-8859-1" seems pointless, and not freeing the old encoding would cause a memory leak. Note that this was last changed in 2008 with commit 6f8611fd which removed unnecessary encoding/decoding steps. Setting attributes should be even faster now. Found by OSS-Fuzz.
* Reduce some fuzzer timeoutsNick Wellnhofer2021-03-013-4/+4
| | | | | | | | OSS-Fuzz has been fuzzing the HTML parser with inputs up to 1 MB for several hundred hours without hitting the 20s timeout. It seems that most timeouts resulting from accidentally quadratic behavior in the HTML parser have been fixed. Start to gradually reduce the timeout to find new performance issues.
* Fix quadratic behavior when looking up xml:* attributesNick Wellnhofer2021-03-011-0/+10
| | | | | | | | | | | | | | Add a special case for the predefined XML namespace when looking up DTD attribute defaults in xmlGetPropNodeInternal to avoid calling xmlGetNsList. This fixes quadratic behavior in - xmlNodeGetBase - xmlNodeGetLang - xmlNodeGetSpacePreserve Found by OSS-Fuzz.
* Only run a few CI tests unless scheduledNick Wellnhofer2021-02-221-0/+24
| | | | | | | | | Only run the following tests by default - gcc - clang:asan - cmake:mingw:w64-x86_64:shared - cmake:msvc:v141:x64:shared
* Improve fuzzer stabilityNick Wellnhofer2021-02-225-0/+15
| | | | | - Add more calls to xmlInitializeCatalog. - Call xmlResetLastError after fuzzing each input.
* Check for feature flags in fuzzer testsNick Wellnhofer2021-02-223-38/+107
|
* Use CMake PROJECT_VERSIONMarkus Rickert2021-02-221-18/+18
|
* Another attempt at improving fuzzer stabilityNick Wellnhofer2021-02-221-0/+2
| | | | xmlInitializeCatalog is not called from xmlInitParser.
* Revert "Improve HTML fuzzer stability"Nick Wellnhofer2021-02-222-6/+0
| | | | This reverts commit de1b51eddcc17fd7ed1bbcc6d5d7d529407dfbe2.
* Add charset names to fuzzing dictionariesNick Wellnhofer2021-02-222-0/+26
|
* Improve HTML fuzzer stabilityNick Wellnhofer2021-02-222-0/+6
| | | | | Call htmlInitAutoClose during fuzzer initialization to fix stability issue. Leave a note concerning problems with this function.