summaryrefslogtreecommitdiff
path: root/xpointer.c
Commit message (Collapse)AuthorAgeFilesLines
* xpath: Remove remaining references to valueFrameNick Wellnhofer2023-04-301-1/+0
| | | | Fixes #529.
* Don't use sizeof(xmlChar) or sizeof(char)Nick Wellnhofer2022-09-011-1/+1
|
* Remove explicit integer castsNick Wellnhofer2022-09-011-7/+7
| | | | | | | | | | | | | | | | | | | | Remove explicit integer casts as final operation - in assignments - when passing arguments - when returning values Remove casts - to the same type - from certain range-bound values The main motivation is that these explicit casts don't change the result of operations and only render UBSan's implicit-conversion checks useless. Removing these casts allows UBSan to detect cases where truncation or sign-changes occur unexpectedly. Document some explicit casts as truncating and add a few missing ones.
* Consolidate private header filesNick Wellnhofer2022-08-261-0/+2
| | | | | | | | | | | Private functions were previously declared - in header files in the root directory - in public headers guarded with IN_LIBXML - in libxml.h - redundantly in source files that used them. Consolidate all private header files in include/private.
* Implement xpath1() XPointer schemeNick Wellnhofer2022-04-211-2/+5
| | | | See https://www.w3.org/2005/04/xpointer-schemes/
* Add configuration flag for XPointer locations supportNick Wellnhofer2022-04-211-2/+18
| | | | | | | | | | | | | | | | | | | | | Add a new configuration flag that controls whether the outdated support for XPointer locations (ranges and points) is enabled. --with-xptr-locs # Autotools LIBXML2_WITH_XPTR_LOCS # CMake The latest spec for what it essentially an XPath extension seems to be this working draft from 2002: https://www.w3.org/TR/xptr-xpointer/ The xpointer() scheme is listed as "being reviewed" in the XPointer registry since at least 2006. libxml2 seems to be the only modern software that tries to implement this spec, but the code has many bugs and quality issues. The flag defaults to "off" and support for this extensions has to be requested explicitly. The relevant API functions are deprecated.
* Fix potential double-free in xmlXPtrStringRangeFunctionNick Wellnhofer2022-03-051-0/+1
| | | | | | | Fix double-free in an unlikely error condition. Thanks to Wentao Liang for the report. Fixes #341.
* Remove DOCBparserNick Wellnhofer2022-03-041-3/+0
| | | | | | | This code has been broken and deprecated since version 2.6.0, released in 2003. Because of a bug in commit 961b535c, DOCBparser.c was never compiled since 2012. I couldn't find a Debian package using any of its symbols, so it seems safe to remove this module.
* Remove elfgcchack.hNick Wellnhofer2022-02-201-2/+0
| | | | | The same optimization can be enabled with -fno-semantic-interposition since GCC 5. clang has always used this option by default.
* Don't normalize namespace URIs in XPointer xmlns() schemeNick Wellnhofer2022-02-041-25/+1
| | | | | | | | Namespace URIs should be compared without escaping or unescaping: https://www.w3.org/TR/REC-xml-names/#NSNameComparison Fixes #289.
* xmlAddChild() and xmlAddNextSibling() may not attach their second argumentDavid Kilzer2022-01-251-7/+6
| | | | | | | | | Use the return value of xmlAddChild() and xmlAddNextSibling() instead of the second argument directly. Found by OSS-Fuzz. Fixes #316
* Fix handling of ctxt->base in xmlXPtrEvalXPtrPartNick Wellnhofer2022-01-251-12/+25
| | | | | | | | | | Also set ctxt->base when updating ctxt->cur. Always restore ctxt->cur on error. Avoids integer truncation and wrong column numbers in xmlXPathErr. Stop hiding modification of ctxt members behind a macro. Found with UBSan.
* Fix null pointer deref in xmlXPtrRangeInsideFunctionNick Wellnhofer2020-12-061-4/+6
| | | | Found by OSS-Fuzz.
* Fix memory leaks in XPointer string-range functionNick Wellnhofer2020-10-031-14/+27
| | | | Found by OSS-Fuzz.
* Don't call xmlXPathInit directlyNick Wellnhofer2020-09-181-1/+1
| | | | | | Call xmlInitParser which uses a lock to avoid race conditions. Fixes #184.
* Fix typosNick Wellnhofer2020-03-081-4/+4
| | | | Resolves #133.
* Large batch of typo fixesJared Yanovich2019-09-301-2/+2
| | | | Closes #109.
* Check for integer overflow in xmlXPtrEvalChildSeqNick Wellnhofer2019-03-291-2/+12
| | | | Found with libFuzzer and UBSan.
* Fix -Wenum-compare warningsNick Wellnhofer2017-11-271-2/+0
| | | | Also fixes a serious bug in xmlXPtrNewRangeNodePoint.
* Porting libxml2 on zOS encoding of codeStéphane Michaut2017-08-281-0/+5
| | | | | | | | | | First set of patches for zOS - entities.c parser.c tree.c xmlschemas.c xmlschemastypes.c xpath.c xpointer.c: ask conversion of code to ISO Latin 1 to avoid having the compiler assume EBCDIC codepoint for characters. - xmlmodule.c: make sure we have support for modules - xmlIO.c: zOS path names are special avoid dsome of the expectstions from Unix/Windows
* Fix memory leaks in XPointer error pathsNick Wellnhofer2017-05-271-1/+10
| | | | Found with libFuzzer and ASan.
* Fix more NULL pointer derefs in xpointer.cNick Wellnhofer2016-10-121-5/+7
| | | | Found with afl-fuzz.
* Disallow namespace nodes in XPointer rangesNick Wellnhofer2016-10-121-93/+56
| | | | | | | | | | Namespace nodes must be copied to avoid use-after-free errors. But they don't necessarily have a physical representation in a document, so simply disallow them in XPointer ranges. Found with afl-fuzz. Fixes CVE-2016-4658.
* Disallow namespace nodes in XPointer pointsNick Wellnhofer2016-10-121-4/+4
|
* Fix XPointer paths beginning with range-toNick Wellnhofer2016-10-121-70/+6
| | | | | | | | | | | | | The old code would invoke the broken xmlXPtrRangeToFunction. range-to isn't really a function but a special kind of location step. Remove this function and always handle range-to in the XPath code. The old xmlXPtrRangeToFunction could also be abused to trigger a use-after-free error with the potential for remote code execution. Found with afl-fuzz. Fixes CVE-2016-5131.
* Fix some format string warnings with possible format string vulnerabilityDavid Kilzer2016-05-231-1/+1
| | | | | | | | For https://bugzilla.gnome.org/show_bug.cgi?id=761029 Decorate every method in libxml2 with the appropriate LIBXML_ATTR_FORMAT(fmt,args) macro and add some cleanups following the reports.
* xpointer : fixing Null PointersGaurav Gupta2014-10-071-0/+28
| | | | | | For https://bugzilla.gnome.org/show_bug.cgi?id=738053 At many places in xpointer.c Null check is missing which is dereferenced at later places.
* Remove Unnecessary Null check in xpointer.cGaurav Gupta2014-10-071-2/+0
| | | | | | For https://bugzilla.gnome.org/show_bug.cgi?id=738052 superfluous check
* Big space and tab cleanupDaniel Veillard2012-09-111-34/+34
| | | | Remove all space before tabs and space and tabs at end of lines.
* Adding various checks on node type though the APIDaniel Veillard2012-08-091-15/+15
| | | | | Specifially checking against namespace nodes before accessing node pointers
* Fix an off by one pointer accessJüri Aedla2012-05-071-11/+4
| | | | getting out of the range of memory allocated for xpointer decoding
* Hardening of XPath evaluationDaniel Veillard2011-08-191-0/+1
| | | | | | Add a mechanism of frame for XPath evaluation when entering a function or a scoped evaluation, also fix a potential problem in predicate evaluation.
* Chasing dead assignments reported by clang-scanDaniel Veillard2009-09-071-2/+1
| | | | | | | | * SAX2.c dict.c error.c hash.c nanohttp.c parser.c python/libxml.c relaxng.c runtest.c tree.c valid.c xinclude.c xmlregexp.c xmlsave.c xmlschemas.c xpath.c xpointer.c: mostly removing unneded affectations, but this led to a few real bugs and some part not yet understood (relaxng/interleave)
* Add symbol versioning to libxml2 shared libsDaniel Veillard2009-08-201-7/+14
| | | | | | | * libxml2.syms: the symbols with history, going back to 2.4.30 * Makefile.am configure.in: linking flags detection and use * parser.c tree.c valid.c xpointer.c: various cleanup of functions which could be made static or simply discarded, not that many
* Skip silently unrecognized XPointer schemesJakub Wilk2009-07-291-1/+3
| | | | | * xpointer.c: unrecognized XPointers should be skipped instead of aborting the full XPointer evaluation
* fix a few warning raised by gcc-4.1 and latests changes DanielDaniel Veillard2006-03-101-2/+2
| | | | | | * c14n.c encoding.c xmlschemas.c xpath.c xpointer.c: fix a few warning raised by gcc-4.1 and latests changes Daniel
* a lot of small cleanups based on Linus' sparse check output. DanielDaniel Veillard2005-07-281-1/+1
| | | | | | | | | * HTMLparser.c SAX2.c encoding.c globals.c parser.c relaxng.c runsuite.c runtest.c schematron.c testHTML.c testReader.c testRegexp.c testSAX.c testThreads.c valid.c xinclude.c xmlIO.c xmllint.c xmlmodule.c xmlschemas.c xpath.c xpointer.c: a lot of small cleanups based on Linus' sparse check output. Daniel
* revamped the elfgcchack.h format to cope with gcc4 change of aliasingDaniel Veillard2005-04-011-1/+2
| | | | | | | | | | | * doc/apibuild.py doc/elfgcchack.xsl: revamped the elfgcchack.h format to cope with gcc4 change of aliasing allowed scopes, had to add extra informations to doc/libxml2-api.xml to separate the header from the c module source. * *.c: updated all c library files to add a #define bottom_xxx and reimport elfgcchack.h thereafter, and a bit of cleanups. * doc//* testapi.c: regenerated when rebuilding the API Daniel
* autogenerate a minimal NULL value sequence for unknown pointer types ThisDaniel Veillard2004-11-051-1/+4
| | | | | | | | | | | | * gentest.py testapi.c: autogenerate a minimal NULL value sequence for unknown pointer types * HTMLparser.c SAX2.c chvalid.c encoding.c entities.c parser.c parserInternals.c relaxng.c valid.c xmlIO.c xmlreader.c xmlsave.c xmlschemas.c xmlschemastypes.c xmlstring.c xpath.c xpointer.c: This uncovered an impressive amount of entry points not checking for NULL pointers when they ought to, closing all the open gaps. Daniel
* extending the tests coverage more fixes and cleanups DanielDaniel Veillard2004-11-041-1/+1
| | | | | | * gentest.py testapi.c: extending the tests coverage * HTMLtree.c tree.c xmlsave.c xpointer.c: more fixes and cleanups Daniel
* enhanced to assure that if xpointer is called for a document, theWilliam M. Brack2004-03-081-5/+8
| | | | | | | | | * xinclude.c: enhanced to assure that if xpointer is called for a document, the XML_PARSE_NOENT flag is set before parsing the included document so that entities will automatically get taken care of. * xpointer.c: corrected code so that, if an XML_ENTITY_REF node is encountered, it will log it and not crash (bug 135713)
* fixed problem with union when last() is used in predicate (bug #131971)William M. Brack2004-01-221-0/+1
| | | | | | * xpath.c: fixed problem with union when last() is used in predicate (bug #131971) * xpointer.c: minor change to comment for doc generation
* fixed problem pointed out by Stéphane Bidoul on the list. completedWilliam M. Brack2003-12-311-7/+12
| | | | | | | | * python/generator.py, python/libxml2class.txt: fixed problem pointed out by Stéphane Bidoul on the list. * xinclude.c, xpointer.c, xpath.c, include/libxml/xpointer.h: completed modifications required to fix Bug 129967 (at last!). Now wait to see how long before further trouble...
* Fixed memory leak reported by Dave Beckett Removed spurious commentWilliam M. Brack2003-12-301-1/+15
| | | | | | | | | | * parser.c, xmlmemory.c, include/libxml/xmlmemory.h: Fixed memory leak reported by Dave Beckett * xmlschemas.c: Removed spurious comment reported on the mailing list * xinclude.c, xpath.c, xpointer.c, libxml/include/xpointer.h: Further work on Bug 129967 concerning xpointer range handling and range-to function; much better, but still not complete
* edited a couple of comments in accordance with posting on the mailing listWilliam M. Brack2003-12-291-1/+5
| | | | | | | | | | | * xmlschemas.c: edited a couple of comments in accordance with posting on the mailing list (no logic change) * xpointer.c: working on Bug 129967, added check for NULL nodeset to prevent crash. Further work required. * xpath.c: working on Bug 129967, added code to handle XPATH_LOCATIONSET in RANGETO code, also added code to handle it in xmlXPathEvaluatePredicateResult. Further work required.
* minor error cleanup for gcc-3.3.[12] compilation warnings.William M. Brack2003-11-141-1/+1
| | | | | | * catalog.c,relaxng.c,testAutomata.c,xpointer.c,genChRanges.py, chvalid.c,include/libxml/chvalid.h,doc/examples/test1.c: minor error cleanup for gcc-3.3.[12] compilation warnings.
* Setting up the framework for structured error reporting, touches a lot ofDaniel Veillard2003-10-101-3/+3
| | | | | | | | | | | * HTMLparser.c c14n.c catalog.c error.c globals.c parser.c parserInternals.c relaxng.c valid.c xinclude.c xmlIO.c xmlregexp.c xmlschemas.c xpath.c xpointer.c include/libxml/globals.h include/libxml/parser.h include/libxml/valid.h include/libxml/xmlerror.h: Setting up the framework for structured error reporting, touches a lot of modules, but little code now the error handling trail has been cleaned up. Daniel
* cleanup migrated XPointer module to the new error mechanism DanielDaniel Veillard2003-10-101-44/+89
| | | | | | | * xpath.c: cleanup * xpointer.c include/libxml/xmlerror.h: migrated XPointer module to the new error mechanism Daniel
* added xmlMallocAtomic() to be used when allocating blocks which do notDaniel Veillard2003-04-191-1/+1
| | | | | | | | | | | | * DOCBparser.c HTMLparser.c c14n.c catalog.c encoding.c globals.c nanohttp.c parser.c parserInternals.c relaxng.c tree.c uri.c xmlmemory.c xmlreader.c xmlregexp.c xpath.c xpointer.c include/libxml/globals.h include/libxml/xmlmemory.h: added xmlMallocAtomic() to be used when allocating blocks which do not contains pointers, add xmlGcMemSetup() and xmlGcMemGet() to allow registering the full set of functions needed by a garbage collecting allocator like libgc, ref #109944 Daniel
* improved the script accordingly to the XInclude regression tests updatesDaniel Veillard2003-02-131-1/+26
| | | | | | | | | | | * check-xinclude-test-suite.py: improved the script accordingly to the XInclude regression tests updates * xpointer.c: Implemented XPointer element() Scheme W3C PR of 13 November 2002 * result/XPath/xptr/chapterschildseq result/XPath/xptr/vidchildseq test/XPath/xptr/chapterschildseq test/XPath/xptr/vidchildseq: augmented the Xpointer testsuite for the element() scheme Daniel