xpath.c


Log

Author Commit Date CI Message
Stéphane Michaut 454e397e 2017-08-28T14:30:43 Porting libxml2 on zOS encoding of code 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
Nick Wellnhofer 7482f41f 2017-06-01T22:00:19 Check for integer overflow in xmlXPathFormatNumber Check for overflow before casting double to int. Found with afl-fuzz and UBSan.
Nick Wellnhofer f4029cd4 2016-04-21T16:37:26 Check XPath exponents for overflow Avoid undefined behavior and wrong results with huge exponents. Found with afl-fuzz and UBSan.
Nick Wellnhofer a58331a6 2017-05-29T21:02:21 Check for overflow in xmlXPathIsPositionalPredicate Avoid undefined behavior when casting from double to int. Found with afl-fuzz and UBSan.
Nick Wellnhofer a851868a 2017-05-29T20:14:42 Parse small XPath numbers more accurately Don't count leading zeros towards the fraction size limit. This allows to parse numbers like 0.0000000000000000000000000000000000000000000000000000000001 which is the only standard-conformant way to represent such numbers, as scientific notation isn't allowed in XPath 1.0. (It is allowed in XPath 2.0 and in libxml2 as an extension, though.) Overall accuracy is still bad, see bug 783238.
Nick Wellnhofer 4bebb030 2016-04-21T13:41:09 Rework XPath rounding functions Use the C library's floor and ceil functions. The old code was overly complicated for no apparent reason and could result in undefined behavior when handling NaNs (found with afl-fuzz and UBSan). Fix wrong comment in xmlXPathRoundFunction. The implementation was already following the spec and rounding half up.
Nick Wellnhofer 40f58521 2017-05-26T20:16:35 Fix axis traversal from attribute and namespace nodes When traversing the "preceding" axis from an attribute node, we must first go up to the attribute's containing element. Otherwise, text children of other attributes could be returned. This made it possible to hit a code path in xmlXPathNextAncestor which contained another bug: The attribute node was initialized with the context node instead of the current node. Normally, this code path is only hit via xmlXPathNextAncestorOrSelf in which case the current and context node are the same. The combination of the two bugs could result in an infinite loop, found with libFuzzer. Traversing the "following" and the "preceding" axis from namespace nodes should be handled similarly. This wasn't supported at all previously.
Nick Wellnhofer a07a4e96 2017-05-27T17:04:12 Fix spurious error message Commit c851970 introduced a spurious error message when evaluating XPath expressions with xmlXPathCompiledEvalToBoolean.
Nick Wellnhofer aed407c1 2017-05-25T16:57:14 Check for trailing characters in XPath expressions earlier Move the check for trailing characters from xmlXPathEval to xmlXPathEvalExpr. Otherwise, a valid portion of a syntactically invalid expression would be evaluated before returning an error.
Nick Wellnhofer c851970c 2017-05-27T15:26:11 Rework final handling of XPath results Move cleanup of XPath stack to xmlXPathFreeParserContext. This avoids memory leaks if valuePop fails in some error cases. Found with libFuzzer and ASan. Rework handling of the final XPath result object in xmlXPathCompiledEvalInternal and xmlXPathEval to avoid useless error messages.
Nick Wellnhofer 640a368c 2017-05-27T14:59:49 Make xmlXPathEvalExpression call xmlXPathEval Both functions are supposed to do exactly the same.
Nick Wellnhofer cf60dbe4 2017-05-25T16:20:56 Fix memory leak in xmlXPathCompareNodeSetValue Implement TODO block to free the arguments in error case. Found with libFuzzer and ASan.
Nick Wellnhofer 9d08b347 2017-05-21T16:46:12 Fix memory leak in xmlXPathNodeSetMergeAndClear Namespaces nodes must not be duplicated when merging. Found with libFuzzer and ASan.
Nick Wellnhofer 95a9249a 2017-05-21T15:18:58 Fix memory leak in XPath filter optimizations Namespace nodes must be freed when selecting the first or last element of a node set. Found with libFuzzer and ASan.
Nick Wellnhofer d42a7063 2017-05-27T14:58:19 Fix memory leaks in XPath error paths Found with libFuzzer and ASan.
Nick Wellnhofer 229d1f93 2016-08-22T13:21:57 Avoid function/data pointer conversion in xpath.c Fixes a `-pedantic` compiler warning.
Nick Wellnhofer 9ab01a27 2016-06-28T14:22:23 Fix XPointer paths beginning with range-to 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.
Nick Wellnhofer a0051993 2016-06-28T14:19:58 Fix comparison with root node in xmlXPathCmpNodes This change has already been made in xmlXPathCmpNodesExt but not in xmlXPathCmpNodes.
Nick Wellnhofer d8083bf7 2016-06-25T12:35:50 Fix NULL pointer deref in XPointer range-to - Check for errors after evaluating first operand. - Add sanity check for empty stack. Found with afl-fuzz.
David Kilzer 4472c3a5 2016-05-13T15:13:17 Fix some format string warnings with possible format string vulnerability 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.
Nick Wellnhofer 6eb0894a 2016-05-05T16:49:00 Fix memory leak with XPath namespace nodes Set hasNsNodes to 1 when adding namespace nodes via XP_TEST_HIT.
Nick Wellnhofer 82b73039 2016-04-30T17:53:10 Fix namespace axis traversal When the namespace axis is traversed in "toBool" mode, the traversal can exit early, before visiting all nodes. In this case, the XPath context still contains a non-NULL tmpNsList. This means that - the check when to start a new traversal was wrong and - the tmpNsList could be leaked. Fixes bug #750037 and, by accident, bug #756075: https://bugzilla.gnome.org/show_bug.cgi?id=750037 https://bugzilla.gnome.org/show_bug.cgi?id=756075
Nick Wellnhofer 839689a9 2016-04-27T18:00:12 Don't recurse into OP_VALUEs in xmlXPathOptimizeExpression The ch1 slot of OP_VALUEs contains an invalid value. Ignore it. Fixes bug #760325: https://bugzilla.gnome.org/show_bug.cgi?id=760325
Nick Wellnhofer f39fd66e 2016-04-27T03:01:16 Fix namespace::node() XPath expression Make sure that xmlXPathNodeSetAddNs is called for namespace nodes when matched with a namespace::node() step. This correctly sets the parent of namespace nodes. Note that xmlXPathNodeSetAddNs must only be called if working on the namespace axis. Otherwise, the context node is not the parent of the namespace node and the standard XP_TEST_HIT macro must be invoked. This explains the errors in the C14N tests that the old TODO comment mentioned.
Nick Wellnhofer e2893903 2016-04-21T19:19:23 Fix parsing of NCNames in XPath The NCName parser would allow any NameChar as start character. For example, the following XPath expressions would compile: self::-abc self::0abc self::.abc
Jan Pokorný bb654feb 2016-04-13T16:56:07 Fix typos: dictio{ nn -> n }ar{y,ies} Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
Shlomi Fish d5bd2a9a 2016-04-03T05:14:44 Correct a typo.
Nick Wellnhofer 3eaedba1 2015-07-11T14:27:34 Fix previous change to node sort order Commit ba58f23 broke comparison of nodes from different documents. Thanks to Olli Pottonen for the report.
Nick Wellnhofer ba58f23c 2015-03-08T16:44:11 Fix order of root nodes Make sure root nodes are sorted before other nodes.
Nick Wellnhofer f6aaabce 2015-03-08T16:05:26 Allow attributes on descendant-or-self axis If the context node is an attribute, the attribute itself is on the descendant-or-self axis. The principal node type of this axis is element, so the only node test that can return the attribute is "node()". In other words, "@attr/descendant-or-self::node()" is equivalent to "@attr". This matches the behavior of Saxon-CE.
Nick Wellnhofer 07def30f 2014-03-21T19:38:08 Restore context size and position after XPATH_OP_ARG Fixes a bug with predicates: https://mail.gnome.org/archives/xml/2014-March/msg00014.html
Jan Pokorný 75801652 2013-12-19T15:09:14 Fix typos in {tree,xpath}.c (errror) Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
Nick Wellnhofer 03c67230 2013-12-20T00:01:53 Handling of XPath function arguments in error case The XPath engine tries to guarantee that every XPath function can pop 'nargs' non-NULL values off the stack. libxslt, for example, relies on this assumption. But the check isn't thorough enough if there are errors during the evaluation of arguments. This can lead to segfaults: https://mail.gnome.org/archives/xslt/2013-December/msg00005.html This commit makes the handling of function arguments more robust. * Bail out early when evaluation of XPath function arguments fails. * Make sure that there are 'nargs' arguments in the current call frame.
Gaurav fcd45831 2013-11-28T23:01:44 Fix XPath node comparison bug For https://bugzilla.gnome.org/show_bug.cgi?id=715143
Nick Wellnhofer e8de99f9 2013-08-05T01:26:25 Fix XPath expressions of the form '@ns:*' Use namespace for match-all queries on the attribute axis.
Nick Wellnhofer b4bcba23 2013-08-05T00:15:11 Fix XPath '//' optimization with predicates My attempt to optimize XPath expressions containing '//' caused a regression reported in bug #695699. This commit disables the optimization for expressions of the form '//foo[predicate]'.
Denis Pauk e28c8a1a 2013-08-03T14:22:54 #705267 - add additional defines checks for support "./configure --with-minimum" https://bugzilla.gnome.org/show_bug.cgi?id=705267
Daniel Veillard b9e4d5b6 2013-07-22T13:21:31 Remove occasional leading space in XPath number formatting https://bugzilla.gnome.org/show_bug.cgi?id=704528 Somehow snprintf "%*.*e" can generate a leading space, remove it
Alex Bligh 28876afb 2013-03-23T17:23:27 Add xmlXPathSetContextNode and xmlXPathNodeEval This patch adds xmlXPathSetContextNode and xmlXPathNodeEval, which make it easier to evaluation XPath expressions with a context node other than the document root without poking about inside the internals of the context. This patch is compile-tested only, and is my first libxml2 contribution, so please go easy. Signed-off-by: Alex Bligh <alex@alex.org.uk>
Daniel Veillard 713434d2 2012-09-26T10:21:06 Silence a clang warning as reported by Hans Wennborg <hans@chromium.org>
Daniel Veillard 7651606f 2012-09-11T14:02:08 Various cleanups to avoid compiler warnings
Daniel Veillard f8e3db04 2012-09-11T13:26:36 Big space and tab cleanup Remove all space before tabs and space and tabs at end of lines.
Daniel Veillard 47881284 2012-09-07T14:24:50 Add a forbidden variable error number and message to XPath Related to https://bugzilla.gnome.org/show_bug.cgi?id=680938 When the XML_XPATH_NOVAR flags is being used it means that variables are forbidden, not that they are missing
Daniel Veillard 1bd45d13 2012-09-05T15:35:19 Change the XPath code to percolate allocation errors looping 1000 time on an error stating that a nodeset has grown out of control is useless, make sure we percolate error up to the various loops and break when errors occurs
Daniel Veillard 510e7583 2012-09-04T11:50:36 Fix a Timsort function helper comment
Vojtech Fried 3e031b7d 2012-08-24T16:52:44 Switching XPath node sorting to Timsort I use libxml xpath engine on quite large (and mostly "flat") xml files. It seems that Shellsort, that is used in xmlXPathNodeSetSort is a performance bottleneck for my case. I have read some posts about sorting in libxml in the libxml archive, but I agree that qsort was not the way to go. I experimented with Timsort instead and my results were good for me. For about 10000 nodes, my test was about 5x faster with Timsort, for 1000 nodes about 10% faster, for small data files, the difference was not measurable. * timsort.h: the algorithm, kept in a separate header * xpath.c: plug in the new algorithm in xmlXPathNodeSetSort * Makefile.am: add the header to the EXTRA_DIST * doc/apibuild.py: avoid indexing the new header
Nick Wellnhofer 62270539 2012-08-19T19:42:38 Optimizing '//' in XPath expressions When investigating the libxslt performance problem reported in bug #657665, I found that '//' in XPath expressions can be very slow when working on large subtrees. One of the reasons is the seemingly quadratic time complexity of the duplicate checks when merging result nodes. The other is a missed optimization for expressions of the form 'descendant-or-self::node()/axis::test'. Since '//' is expanded to '/descendant-or-self::node()/', this type of expression is quite common. Depending on the axis of the expression following the 'descendant-or-self' step, the following replacements can be made: from descendant-or-self::node()/child::test to descendant::test from descendant-or-self::node()/descendant::test to descendant::test from descendant-or-self::node()/self::test to descendant-or-self::test from descendant-or-self::node()/descendant-or-self::test to descendant-or-self::test 'test' can be any kind of node test. With these replacements the possibly huge result of 'descendant-or-self::node()' doesn't have to be stored temporarily, but can be processsed in one pass. If the resulting nodeset is small, the duplicate checks aren't a problem. I found that there already is a function called xmlXPathRewriteDOSExpression which performs this optimization for a very limited set of cases. It employs a complicated iteration scheme for rewritten expressions. AFAICS, this can be avoided by simply changing the axis of the expression like described above. With the attached patch against libxml2 and the files from bug #657665 I got the following results. Before: $ time xsltproc/xsltproc --noout service-names-port-numbers.xsl service-names-port-numbers.xml real 2m56.213s user 2m56.123s sys 0m0.080s After: $ time xsltproc/xsltproc --noout service-names-port-numbers.xsl service-names-port-numbers.xml real 0m3.836s user 0m3.764s sys 0m0.060s I also ran the libxml2 and libxslt test suites with the patch and couldn't detect any breakage. Nick >From e0f5a8261760e4f257b90410be27657e984237c8 Mon Sep 17 00:00:00 2001 From: Nick Wellnhofer <wellnhofer@aevum.de> Date: Sun, 19 Aug 2012 18:20:22 +0200 Subject: [PATCH] Optimizations for descendant-or-self::node() Currently, the function xmlXPathRewriteDOSExpression optimizes expressions of type '//child'. Instead of adding a 'rewriteType' and doing a compound traversal, the same can be achieved simply by setting the axis of the node test from 'child' to 'descendant'. There are also many other cases that can be optimized similarly. This commit augments xmlXPathRewriteDOSExpression to essentially rewrite the following subexpressions: - descendant-or-self::node()/child:: to descendant:: - descendant-or-self::node()/descendant:: to descendant:: - descendant-or-self::node()/self:: to descendant-or-self:: - descendant-or-self::node()/descendant-or-self:: to descendant-or-self:: Since the '//' shortcut in XPath is translated to '/descendant-or-self::node()/', this greatly speeds up expressions using '//' on large subtrees.
Daniel Veillard 3e62adbe 2012-08-09T14:24:02 Adding various checks on node type though the API Specifially checking against namespace nodes before accessing node pointers
Daniel Veillard cd852ad1 2012-07-30T10:12:18 Implement some default limits in the XPath module This adds some internal limitationson XPath expression complexity, and limits at runtime like depth of the stack and maximum size for nodeset. * xpath.c: implement the above as well as the maximum Name lenght
Daniel Veillard ade10f2c 2012-07-12T09:43:27 Convert XPath to xmlBuf Easy as no buffer was exported in the APIs
Daniel Veillard 1d4526f6 2011-10-11T16:34:34 Fix missing error status in XPath evaluation Started by Chris Evans, I added a few more place where the error should have been set in the evaluation context.
Daniel Veillard f5048b3e 2011-08-18T17:10:13 Hardening of XPath evaluation Add a mechanism of frame for XPath evaluation when entering a function or a scoped evaluation, also fix a potential problem in predicate evaluation.
Stefan Kost a1540403 2011-05-06T17:03:51 xpath: remove unused variable As noted by gcc, this variable is not beeing used.
Chris Evans d7958b21 2011-03-23T08:13:06 Fix some potential problems on reallocation failures The count was incremented before the allocation and not fixed in case of failure * xpath.c: corrects a few instances where the available count of some structure is updated before we know the allocation actually succeeds
Daniel Veillard fec31bcd 2010-11-18T11:07:24 Small fix for previous commit
Daniel Veillard df83c17e 2010-11-17T14:12:14 Fix a potential freeing error in XPath
Daniel Veillard 0cbeb50e 2010-11-15T12:06:29 Fix a potential memory access error in case of a previus allocation error
Phil Shafer ee32ad3c 2010-11-03T20:53:55 629325 XPath rounding errors first cleanup https://bugzilla.gnome.org/show_bug.cgi?id=629325 not a full solution as Vincent Lefevre pointed out but an incremental improvement over the status-quo
Daniel Veillard ea90b894 2010-10-22T15:50:50 Fix a change of semantic on XPath preceding and following axis This was introduced in the prevous fix, while preceding-sibling and following sibling axis are empty for attributes and namespaces, preceding and following axis should still work based on the parent element. However the parent element is not available for a namespace node, so we keep the axis empty in that case.
Daniel Veillard 2f3523f6 2010-10-15T18:30:29 Fix a leak in XPath compilation Sometimes a not well formed XPath expression could lead to a leak as reported by Ralf Junker <ralfjunker@gmx.de>
Daniel Veillard 91d19754 2010-10-15T14:30:52 Fix the semantic of XPath axis for namespace/attribute context nodes The processing of namespace and attributes nodes was not compliant to the XPath-1.0 specification
Marius Wachtler 2ddecc23 2010-10-12T09:09:07 Fix a small bug in XPath evaluation code
Martin 729601f1 2009-10-12T22:42:26 Fix memory leak in xmlXPathEvalExpression() * xpath.c: plug some leaks when parsing misformed XPath expressions * python/tests/xpathleak.py: expand the regression tests for those
Daniel Veillard 594e5dfb 2009-09-07T14:58:47 Chasing dead assignments reported by clang-scan * 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)
Daniel Veillard 13cee4e3 2009-09-05T14:52:55 Fix a bunch of scan 'dead increments' and cleanup * HTMLparser.c c14n.c debugXML.c entities.c nanohttp.c parser.c testC14N.c uri.c xmlcatalog.c xmllint.c xmlregexp.c xpath.c: fix unused variables, or unneeded increments as well as a couple of space issues * runtest.c: check for NULL before calling unlink()
Daniel Veillard bccae2d2 2009-06-04T11:22:45 * c14n.c debugXML.c doc/examples/io2.c parser.c schematron.c valid.c xmlschemas.c xmlwriter.c xpath.c: use %s to printf string patch by Christian Persch, fixes #581612
Daniel Veillard 48b3eb22 2009-03-25T09:51:19 fixes for Borland/CodeGear/Embarcadero compilers by Eric Zurcher Daniel * include/wsockcompat.h win32/Makefile.bcb xpath.c: fixes for Borland/CodeGear/Embarcadero compilers by Eric Zurcher Daniel svn path=/trunk/; revision=3822
Daniel Veillard db3ce969 2009-03-25T09:43:49 xmlXPathRegisterNs should not allow enpty prefixes daniel * xpath.c: xmlXPathRegisterNs should not allow enpty prefixes daniel svn path=/trunk/; revision=3821
Daniel Veillard f63085de 2009-01-18T20:53:59 port patch from Marcus Meissner to add gcc checking for printf like * include/libxml/parser.h include/libxml/xmlwriter.h include/libxml/relaxng.h include/libxml/xmlversion.h.in include/libxml/xmlwin32version.h.in include/libxml/valid.h include/libxml/xmlschemas.h include/libxml/xmlerror.h: port patch from Marcus Meissner to add gcc checking for printf like functions parameters, should fix #65068 * doc/apibuild.py doc/*: modified the script accordingly and regenerated * xpath.c xmlmemory.c threads.c: fix a few warnings Daniel svn path=/trunk/; revision=3813
Daniel Veillard 074f37e7 2008-09-01T13:38:22 applied a couple of patches from Martin avoiding some leaks, fixinq QName * schematron.c xpath.c: applied a couple of patches from Martin avoiding some leaks, fixinq QName checks in XPath, XPath debugging and schematron code cleanups. * python/tests/Makefile.am python/tests/xpathleak.py: add the specific regression tests, just tweak it to avoid output by default Daniel svn path=/trunk/; revision=3791
Daniel Veillard 45490aeb 2008-07-29T09:13:19 space and tabs cleanup Daniel * xpath.c: space and tabs cleanup Daniel svn path=/trunk/; revision=3756
Daniel Veillard f88d849a 2008-04-01T08:00:31 two patches from Alvaro Herrera to avoid problem when running out of * xpath.c: two patches from Alvaro Herrera to avoid problem when running out of memory in XPath evaluations. Daniel svn path=/trunk/; revision=3721
William M. Brack f179456d 2007-08-23T12:58:13 fixed mlXPathCompOpEvalPositionalPredicate problem with object caching * xpath.c: fixed mlXPathCompOpEvalPositionalPredicate problem with object caching (bug #469410) svn path=/trunk/; revision=3653
William M. Brack 31700e63 2007-06-13T20:33:02 fixed problem in previous fix to xmlXPathNodeSetSort * xpath.c: fixed problem in previous fix to xmlXPathNodeSetSort svn path=/trunk/; revision=3640
William M. Brack 97ac819c 2007-06-06T17:19:24 fixed problem with xmlXPathNodeSetSort; fixed problem with * xpath.c: fixed problem with xmlXPathNodeSetSort; fixed problem with xmlXPathNodeTrailingSorted (both bug#413451) svn path=/trunk/; revision=3622
William M. Brack d611c88a 2007-05-31T05:07:17 fixed problem with string value for PI node (bug #442275) * xpath.c: fixed problem with string value for PI node (bug #442275) svn path=/trunk/; revision=3621
William M. Brack d2f682a4 2007-05-15T19:42:08 fixed problem on gzip streams (bug #438045) fixed minor spot of redundant * nanohttp.c: fixed problem on gzip streams (bug #438045) * xpath.c: fixed minor spot of redundant code - no logic change. svn path=/trunk/; revision=3616
William M. Brack ca79788e 2007-05-11T14:45:53 enhanced the coding for xmlXPathCastNumberToString in order to produce the * xpath.c: enhanced the coding for xmlXPathCastNumberToString in order to produce the required number of significant digits (bug #437179) svn path=/trunk/; revision=3615
William M. Brack ee0b982f 2007-03-07T08:15:01 fixed xmlXPathCmpNodes for incorrect result on certain cases when * xpath.c: fixed xmlXPathCmpNodes for incorrect result on certain cases when comparing identical nodes (bug 415567) with patch from Oleg Paraschenko svn path=/trunk/; revision=3587
William M. Brack 0bcec06d 2007-02-14T02:15:19 Fixed memory bug with invalid function reported by Francois Delyon on * xpath.c: Fixed memory bug with invalid function reported by Francois Delyon on mailing list svn path=/trunk/; revision=3584
William M. Brack 11be2d02 2007-01-24T19:17:19 added checks for alloc fail on calls to xmlXPathNewContext (libxslt bug * xpath.c: added checks for alloc fail on calls to xmlXPathNewContext (libxslt bug #400242) svn path=/trunk/; revision=3575
Daniel Veillard fe3970e0 2006-11-23T16:08:30 fixed a bug where the principal node type of an axis wasn't tested on name * xpath.c: fixed a bug where the principal node type of an axis wasn't tested on name check, fixes bug #377432 daniel
Daniel Veillard 17970a72 2006-10-26T08:55:47 William spotted an obvious bug Daniel * xpath.c: William spotted an obvious bug Daniel
Daniel Veillard c465ffc2 2006-10-17T19:39:33 applied patch from Olaf Walkowiak which should fix #334104 Daniel * xpath.c: applied patch from Olaf Walkowiak which should fix #334104 Daniel
Kasimier T. Buchcik 50128ad7 2006-08-15T13:04:07 Applied the proposed fix for the documentation of xmlXPathCastToString(); * xpath.c: Applied the proposed fix for the documentation of xmlXPathCastToString(); see bug #346202.
Kasimier T. Buchcik 889b7622 2006-07-03T11:44:13 Changed xmlXPathCollectAndTest() to use xmlXPathNodeSetAddNs() when adding * xpath.c: Changed xmlXPathCollectAndTest() to use xmlXPathNodeSetAddNs() when adding a ns-node in case of NODE_TEST_TYPE (the ns-node was previously added plainly to the list). Since for NODE_TEST_ALL and NODE_TEST_NAME this specialized ns-addition function was already used, I assume it was missed to be used with NODE_TEST_TYPE.
Kasimier T. Buchcik 2bdb12ff 2006-06-29T10:49:59 Fixed a double-free in xmlXPathCompOpEvalToBoolean(), revealed by a * xpath.c: Fixed a double-free in xmlXPathCompOpEvalToBoolean(), revealed by a Libxslt regression test.
Kasimier T. Buchcik 324c75b3 2006-06-29T10:31:35 Enhanced xmlXPathCompOpEvalToBoolean() to be also usable outside predicate * xpath.c: Enhanced xmlXPathCompOpEvalToBoolean() to be also usable outside predicate evaluation; the intention is to use it via xmlXPathCompiledEvalToBoolean() for XSLT tests, like in <xsl:if test="/foo">.
Kasimier T. Buchcik 8af1f0bb 2006-06-28T17:13:19 Fix a memory leak which occurred when using * xpath.c: Fix a memory leak which occurred when using xmlXPathCompiledEvalToBoolean().
Kasimier T. Buchcik 631ea817 2006-06-26T16:47:25 Added xmlXPathCompiledEvalToBoolean() to the API and adjusted/added * xpath.c: Added xmlXPathCompiledEvalToBoolean() to the API and adjusted/added xmlXPathRunEval(), xmlXPathRunStreamEval(), xmlXPathCompOpEvalToBoolean(), xmlXPathNodeCollectAndTest() to be aware of a boolean result request. The new function is now used to evaluate predicates.
Kasimier T. Buchcik 6422d916 2006-06-26T14:31:53 Fixed an bug in xmlXPathCompExprAdd(): the newly introduced field * xpath.c: Fixed an bug in xmlXPathCompExprAdd(): the newly introduced field @rewriteType on xmlXPathStepOp was not initialized to zero here; this could lead to the activation of the axis rewrite code in xmlXPathNodeCollectAndTest() when @rewriteType is randomly set to the value 1. A test (hardcoding the intial value to 1) revealed that the resulting incorrect behaviour is similar to the behaviour as described by Arnold Hendriks on the mailing list; so I hope that will fix the issue.
Kasimier T. Buchcik 766ed7e1 2006-06-23T16:32:41 Fixed an error in xmlXPathEvalExpr(), which was introduced with the * xpath.c: Fixed an error in xmlXPathEvalExpr(), which was introduced with the addition of the d-o-s rewrite and made xpath.c unable to compile if XPATH_STREAMING was not defined (reported by Kupriyanov Anatolij - #345752). Fixed the check for d-o-s rewrite to work on the correct XPath string, which is ctxt->base and not comp->expr in this case.
Kasimier T. Buchcik 9bca933a 2006-06-19T10:26:42 Added optimization for positional predicates (only short-hand form "[n]"), * xpath.c: Added optimization for positional predicates (only short-hand form "[n]"), which have a preceding predicate: "/foo[descendant::bar][3]".
Kasimier T. Buchcik 7cb3fa9d 2006-06-06T15:27:46 Fixed self-invented a segfault in xmlXPathCtxtCompile(), when the * xpath.c: Fixed self-invented a segfault in xmlXPathCtxtCompile(), when the expression was not valid and @comp was NULL and I tried to do the d-o-s rewrite.
Kasimier T. Buchcik 080152c9 2006-06-06T09:42:15 Enabled the compound traversal again; I added a check to use this only if * xpath.c: Enabled the compound traversal again; I added a check to use this only if the have an expression starting with the document node; so in the case of "//foo", we already know at compilation-time, that there will be only 1 initial context node. Added the rewrite also to xmlXPathEvalExpr().
Kasimier T. Buchcik c42e9f64 2006-06-02T20:48:50 Disabled the compound traversal for the release; I need first to assure * xpath.c: Disabled the compound traversal for the release; I need first to assure that this is done only if we have 1 initial node.
Aleksey Sanin 1b2be101 2006-05-31T20:53:43 fixed memory leak in xpath error reporting * xpath.c: fixed memory leak in xpath error reporting
Kasimier T. Buchcik 5869469f 2006-05-31T12:37:28 Changed the name of the recently added public function * xpath.c include/libxml/xpath.h runsuite.c: Changed the name of the recently added public function xmlXPathContextSetObjectCache() to xmlXPathContextSetCache(); so a more generic one, in case we decide to cache more things than only XPath objects.
Kasimier T. Buchcik df0ba264 2006-05-30T19:45:37 Optimized xmlXPathNodeCollectAndTest() and xmlXPathNodeCollectAndTestNth() * xpath.c: Optimized xmlXPathNodeCollectAndTest() and xmlXPathNodeCollectAndTestNth() to evaluate a compound traversal of 2 axes when we have a "//foo" expression. This is done with a rewrite of the XPath AST in xmlXPathRewriteDOSExpression(); I added an additional field to xmlXPathStepOp for this (but the field's name should be changed). The mechanism: the embracing descendant-or-self axis traversal (also optimized to return only nodes which can hold elements), will produce context nodes for the inner traversal of the child axis. This way we avoid a full node-collecting traversal of the descendant-or-self axis. Some tests indicate that this can reduce execution time of "//foo" to 50%. Together with the XPath object cache this all significantly speeds up libxslt.
Kasimier T. Buchcik 75af2a87 2006-05-30T09:29:23 Enhanced xmlXPathNodeCollectAndTest() to avoid recreation (if possible) of * xpath.c: Enhanced xmlXPathNodeCollectAndTest() to avoid recreation (if possible) of the node-set which is used to collect the nodes in the current axis for the currect context node. Especially for "//foo" this will decrease dramatically the number of created node-sets, since for each node in the result node-set of the evaluation of descendant-or-self::node() a new temporary node-set was created. Added node iterator xmlXPathNextChildElement() as a tiny optimization for child::foo.