1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-02-22 21:57:21 +03:00

358 Commits

Author SHA1 Message Date
Daniel Veillard
1d4526f6f4 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.
2011-10-11 16:34:34 +08:00
Daniel Veillard
f5048b3e71 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.
2011-08-19 11:07:51 +08:00
Stefan Kost
a15404034c xpath: remove unused variable
As noted by gcc, this variable is not beeing used.
2011-05-09 11:48:21 +03:00
Chris Evans
d7958b21e7 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
2011-03-23 08:13:06 +08:00
Daniel Veillard
fec31bcd45 Small fix for previous commit 2010-11-18 11:07:24 +01:00
Daniel Veillard
df83c17e5a Fix a potential freeing error in XPath 2010-11-17 14:12:14 +01:00
Daniel Veillard
0cbeb50ee0 Fix a potential memory access error
in case of a previus allocation error
2010-11-15 12:10:14 +01:00
Phil Shafer
ee32ad3c0f 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
2010-11-03 20:53:55 +01:00
Daniel Veillard
ea90b89414 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.
2010-10-22 15:50:50 +02:00
Daniel Veillard
2f3523f61f 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>
2010-10-15 18:30:29 +02:00
Daniel Veillard
91d19754d4 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
2010-10-15 14:30:52 +02:00
Marius Wachtler
2ddecc2386 Fix a small bug in XPath evaluation code 2010-10-12 09:09:07 +02:00
Martin
729601f157 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
2009-10-12 22:42:26 +02:00
Daniel Veillard
594e5dfb48 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)
2009-09-07 14:58:47 +02:00
Daniel Veillard
13cee4e37b 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()
2009-09-05 14:52:55 +02:00
Daniel Veillard
bccae2d210 * 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
2009-06-04 11:22:45 +02:00
Daniel Veillard
48b3eb22c2 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
2009-03-25 09:51:19 +00:00
Daniel Veillard
db3ce96906 xmlXPathRegisterNs should not allow enpty prefixes daniel
* xpath.c: xmlXPathRegisterNs should not allow enpty prefixes
daniel

svn path=/trunk/; revision=3821
2009-03-25 09:43:49 +00:00
Daniel Veillard
f63085de5e 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
2009-01-18 20:53:59 +00:00
Daniel Veillard
074f37e7eb 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
2008-09-01 13:38:22 +00:00
Daniel Veillard
45490aebe7 space and tabs cleanup Daniel
* xpath.c: space and tabs cleanup
Daniel

svn path=/trunk/; revision=3756
2008-07-29 09:13:19 +00:00
Daniel Veillard
f88d849a4e 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
2008-04-01 08:00:31 +00:00
William M. Brack
f179456d0f fixed mlXPathCompOpEvalPositionalPredicate problem with object caching
* xpath.c: fixed mlXPathCompOpEvalPositionalPredicate problem
  with object caching (bug #469410)

svn path=/trunk/; revision=3653
2007-08-23 12:58:13 +00:00
William M. Brack
31700e6306 fixed problem in previous fix to xmlXPathNodeSetSort
* xpath.c: fixed problem in previous fix to xmlXPathNodeSetSort

svn path=/trunk/; revision=3640
2007-06-13 20:33:02 +00:00
William M. Brack
97ac819cc6 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
2007-06-06 17:19:24 +00:00
William M. Brack
d611c88a01 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
2007-05-31 05:07:17 +00:00
William M. Brack
d2f682a495 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
2007-05-15 19:42:08 +00:00
William M. Brack
ca79788eaa 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
2007-05-11 14:45:53 +00:00
William M. Brack
ee0b982fe8 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
2007-03-07 08:15:01 +00:00
William M. Brack
0bcec06d4c 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
2007-02-14 02:15:19 +00:00
William M. Brack
11be2d02b0 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
2007-01-24 19:17:19 +00:00
Daniel Veillard
fe3970e09f 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
2006-11-23 16:08:30 +00:00
Daniel Veillard
17970a72ca William spotted an obvious bug Daniel
* xpath.c: William spotted an obvious bug
Daniel
2006-10-26 08:55:47 +00:00
Daniel Veillard
c465ffc20c applied patch from Olaf Walkowiak which should fix #334104 Daniel
* xpath.c: applied patch from Olaf Walkowiak which should fix #334104
Daniel
2006-10-17 19:39:33 +00:00
Kasimier T. Buchcik
50128ad7cc Applied the proposed fix for the documentation of xmlXPathCastToString();
* xpath.c: Applied the proposed fix for the documentation
  of xmlXPathCastToString(); see bug #346202.
2006-08-15 13:04:07 +00:00
Kasimier T. Buchcik
889b76229b 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.
2006-07-03 11:44:13 +00:00
Kasimier T. Buchcik
2bdb12ff9f Fixed a double-free in xmlXPathCompOpEvalToBoolean(), revealed by a
* xpath.c: Fixed a double-free in xmlXPathCompOpEvalToBoolean(),
  revealed by a Libxslt regression test.
2006-06-29 10:49:59 +00:00
Kasimier T. Buchcik
324c75b3c3 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">.
2006-06-29 10:31:35 +00:00
Kasimier T. Buchcik
8af1f0bb83 Fix a memory leak which occurred when using
* xpath.c: Fix a memory leak which occurred when using
  xmlXPathCompiledEvalToBoolean().
2006-06-28 17:13:19 +00:00
Kasimier T. Buchcik
631ea8176a 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.
2006-06-26 16:47:25 +00:00
Kasimier T. Buchcik
6422d916d9 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.
2006-06-26 14:31:53 +00:00
Kasimier T. Buchcik
766ed7e1e5 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.
2006-06-23 16:32:41 +00:00
Kasimier T. Buchcik
9bca933a6e 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]".
2006-06-19 10:26:42 +00:00
Kasimier T. Buchcik
7cb3fa9d51 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.
2006-06-06 15:27:46 +00:00
Kasimier T. Buchcik
080152c901 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().
2006-06-06 09:42:15 +00:00
Kasimier T. Buchcik
c42e9f6409 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.
2006-06-02 20:48:50 +00:00
Aleksey Sanin
1b2be101e8 fixed memory leak in xpath error reporting
* xpath.c: fixed memory leak in xpath error reporting
2006-05-31 20:53:43 +00:00
Kasimier T. Buchcik
5869469f42 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.
2006-05-31 12:37:28 +00:00
Kasimier T. Buchcik
df0ba26409 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.
2006-05-30 19:45:37 +00:00
Kasimier T. Buchcik
75af2a87e5 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.
2006-05-30 09:29:23 +00:00