~ubuntu-branches/ubuntu/utopic/libxml2/utopic

« back to all changes in this revision

Viewing changes to debian/patches/0023-Handling-of-XPath-function-arguments-in-error-case.patch

  • Committer: Package Import Robot
  • Author(s): Aron Xu, Christian Svensson, Daniel Schepler, Helmut Grohne, Adam Conrad, Matthias Klose, Aron Xu
  • Date: 2014-07-09 05:40:15 UTC
  • mfrom: (43.2.6 sid)
  • Revision ID: package-import@ubuntu.com-20140709054015-1q7dyagza4p2gkm0
Tags: 2.9.1+dfsg1-4
[ Christian Svensson ]
* Do not build-depend on readline (Closes: #742350)

[ Daniel Schepler ]
* Patch to bootstrap without python (Closes: #738080)

[ Helmut Grohne ]
* Drop unneeded B-D on perl and binutils (Closes: #753005)

[ Adam Conrad ]
* Actually run dh_autoreconf, which the old/new mixed rules file misses.

[ Matthias Klose ]
* Add patch to fix python multiarch issue
* Allow the package to cross-build by tweaking B-Ds on python
* Set PYTHON_LIBS for cross builds

[ Aron Xu ]
* Use correct $CC
* Configure udeb without python
* New round of cherry-picking upstream fixes
  - Includes fixes for CVE-2014-0191 (Closes: #747309).
* Call prename with -vf
* Require python-all-dev (>= 2.7.5-5~)
* Bump std-ver: 3.9.4 -> 3.9.5, no change

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
From: Nick Wellnhofer <wellnhofer@aevum.de>
 
2
Date: Fri, 20 Dec 2013 00:01:53 +0100
 
3
Subject: Handling of XPath function arguments in error case
 
4
 
 
5
The XPath engine tries to guarantee that every XPath function can pop
 
6
'nargs' non-NULL values off the stack. libxslt, for example, relies on
 
7
this assumption. But the check isn't thorough enough if there are errors
 
8
during the evaluation of arguments. This can lead to segfaults:
 
9
 
 
10
https://mail.gnome.org/archives/xslt/2013-December/msg00005.html
 
11
 
 
12
This commit makes the handling of function arguments more robust.
 
13
 
 
14
* Bail out early when evaluation of XPath function arguments fails.
 
15
* Make sure that there are 'nargs' arguments in the current call frame.
 
16
---
 
17
 xpath.c |    9 +++++++--
 
18
 1 file changed, 7 insertions(+), 2 deletions(-)
 
19
 
 
20
diff --git a/xpath.c b/xpath.c
 
21
index a676989..a75df9b 100644
 
22
--- a/xpath.c
 
23
+++ b/xpath.c
 
24
@@ -13512,10 +13512,15 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
 
25
                 int frame;
 
26
 
 
27
                 frame = xmlXPathSetFrame(ctxt);
 
28
-                if (op->ch1 != -1)
 
29
+                if (op->ch1 != -1) {
 
30
                     total +=
 
31
                         xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
 
32
-               if (ctxt->valueNr < op->value) {
 
33
+                    if (ctxt->error != XPATH_EXPRESSION_OK) {
 
34
+                        xmlXPathPopFrame(ctxt, frame);
 
35
+                        return (total);
 
36
+                    }
 
37
+                }
 
38
+               if (ctxt->valueNr < ctxt->valueFrame + op->value) {
 
39
                    xmlGenericError(xmlGenericErrorContext,
 
40
                            "xmlXPathCompOpEval: parameter error\n");
 
41
                    ctxt->error = XPATH_INVALID_OPERAND;