components/libxml2/patches/11.CVE-2011-2821.patch
author Kevin Crowe <Kevin.Crowe@oracle.com>
Wed, 11 Jan 2012 12:38:47 -0800
changeset 651 501e808038f6
parent 624 c33a34e65bdb
permissions -rw-r--r--
7126712 xsltproc dies in xmlXPathReleaseObject with new patches
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
651
501e808038f6 7126712 xsltproc dies in xmlXPathReleaseObject with new patches
Kevin Crowe <Kevin.Crowe@oracle.com>
parents: 624
diff changeset
     1
The contents of this patch taken directly from upstream:
624
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
     2
http://git.gnome.org/browse/libxml2/commit/?id=f5048b3e71fc30ad096970b8df6e7af073bae4cb
651
501e808038f6 7126712 xsltproc dies in xmlXPathReleaseObject with new patches
Kevin Crowe <Kevin.Crowe@oracle.com>
parents: 624
diff changeset
     3
via copy/paste of the code changes into the source files from which I generated new
501e808038f6 7126712 xsltproc dies in xmlXPathReleaseObject with new patches
Kevin Crowe <Kevin.Crowe@oracle.com>
parents: 624
diff changeset
     4
patch diffs.  This explains the error of the missing 3 lines that are concatenated
501e808038f6 7126712 xsltproc dies in xmlXPathReleaseObject with new patches
Kevin Crowe <Kevin.Crowe@oracle.com>
parents: 624
diff changeset
     5
to the bottom of this patch.
624
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
     6
--- libxml2-2.7.6/xpath.c	Wed Nov 30 08:31:34 2011
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
     7
+++ libxml2-2.7.6/new.xpath.c	Wed Nov 30 08:30:31 2011
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
     8
@@ -252,6 +252,7 @@
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
     9
     "Encoding error\n",
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    10
     "Char out of XML range\n",
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    11
     "Invalid or incomplete context\n",
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    12
+    "Stack usage error\n",
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    13
     "?? Unknown error ??\n"	/* Must be last in the list! */
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    14
 };
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    15
 #define MAXERRNO ((int)(sizeof(xmlXPathErrorMessages) /	\
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    16
@@ -2398,6 +2399,42 @@
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    17
  ************************************************************************/
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    18
 
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    19
 /**
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    20
+ * xmlXPathSetFrame:
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    21
+ * @ctxt: an XPath parser context
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    22
+ *
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    23
+ * Set the callee evaluation frame
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    24
+ *
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    25
+ * Returns the previous frame value to be restored once done
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    26
+ */
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    27
+static int
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    28
+xmlXPathSetFrame(xmlXPathParserContextPtr ctxt) {
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    29
+    int ret;
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    30
+
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    31
+    if (ctxt == NULL)
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    32
+	return(0);
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    33
+    ret = ctxt->valueFrame;
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    34
+    ctxt->valueFrame = ctxt->valueNr;
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    35
+    return(ret);
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    36
+}
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    37
+
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    38
+/**
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    39
+ * xmlXPathPopFrame:
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    40
+ * @ctxt: an XPath parser context
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    41
+ * @frame: the previous frame value
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    42
+ *
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    43
+ * Remove the callee evaluation frame
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    44
+ */
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    45
+static void
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    46
+xmlXPathPopFrame(xmlXPathParserContextPtr ctxt, int frame) {
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    47
+    if (ctxt == NULL)
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    48
+	return;
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    49
+    if (ctxt->valueNr < ctxt->valueFrame) {
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    50
+	xmlXPatherror(ctxt, __FILE__, __LINE__, XPATH_STACK_ERROR);
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    51
+    }
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    52
+    ctxt->valueFrame = frame;
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    53
+}
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    54
+
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    55
+/**
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    56
  * valuePop:
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    57
  * @ctxt: an XPath evaluation context
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    58
  *
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    59
@@ -2412,6 +2449,12 @@
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    60
 
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    61
     if ((ctxt == NULL) || (ctxt->valueNr <= 0))
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    62
         return (NULL);
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    63
+
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    64
+    if (ctxt->valueNr <= ctxt->valueFrame) {
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    65
+	xmlXPatherror(ctxt, __FILE__, __LINE__, XPATH_STACK_ERROR);
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    66
+	return (NULL);
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    67
+    }
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    68
+
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    69
     ctxt->valueNr--;
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    70
     if (ctxt->valueNr > 0)
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    71
         ctxt->value = ctxt->valueTab[ctxt->valueNr - 1];
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    72
@@ -6154,6 +6197,7 @@
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    73
     ret->valueNr = 0;
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    74
     ret->valueMax = 10;
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    75
     ret->value = NULL;
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    76
+    ret->valueFrame = 0;
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    77
 
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    78
     ret->context = ctxt;
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    79
     ret->comp = comp;
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    80
@@ -11688,6 +11732,7 @@
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    81
 	xmlXPathObjectPtr contextObj = NULL, exprRes = NULL;
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    82
 	xmlNodePtr oldContextNode, contextNode = NULL;
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    83
 	xmlXPathContextPtr xpctxt = ctxt->context;
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    84
+	int frame;
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    85
 
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    86
 #ifdef LIBXML_XPTR_ENABLED
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    87
 	    /*
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    88
@@ -11707,6 +11752,8 @@
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    89
 	*/
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    90
 	exprOp = &ctxt->comp->steps[op->ch2];
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    91
 	for (i = 0; i < set->nodeNr; i++) {
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    92
+	    xmlXPathObjectPtr tmp;
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    93
+
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    94
 	    if (set->nodeTab[i] == NULL)
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    95
 		continue;
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    96
 
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    97
@@ -11738,19 +11785,18 @@
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    98
 	    res = xmlXPathCompOpEvalToBoolean(ctxt, exprOp, 1);
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
    99
 
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   100
 	    if ((ctxt->error != XPATH_EXPRESSION_OK) || (res == -1)) {
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   101
-	        xmlXPathObjectPtr tmp;
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   102
-		/* pop the result if any */
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   103
-		tmp = valuePop(ctxt);
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   104
-		if (tmp != contextObj) {
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   105
+		while (tmp != contextObj) {
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   106
 		   /*
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   107
 		    * Free up the result
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   108
 		    * then pop off contextObj, which will be freed later
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   109
 		    */
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   110
 		   xmlXPathReleaseObject(xpctxt, tmp);
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   111
-		   valuePop(ctxt);
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   112
+		   tmp = valuePop(ctxt);
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   113
 		}
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   114
 		goto evaluation_error;
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   115
 	    }
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   116
+	    /* push the result back onto the stack */
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   117
+	    valuePush(ctxt, tmp);
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   118
 
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   119
 	    if (res)
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   120
 		pos++;
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   121
@@ -13354,7 +13400,9 @@
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   122
                 xmlXPathFunction func;
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   123
                 const xmlChar *oldFunc, *oldFuncURI;
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   124
 		int i;
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   125
+		int frame;
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   126
 
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   127
+		frame = xmlXPathSetFrame(ctxt);
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   128
                 if (op->ch1 != -1)
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   129
                     total +=
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   130
                         xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]);
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   131
@@ -13362,15 +13410,18 @@
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   132
 		    xmlGenericError(xmlGenericErrorContext,
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   133
 			    "xmlXPathCompOpEval: parameter error\n");
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   134
 		    ctxt->error = XPATH_INVALID_OPERAND;
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   135
+		    xmlXPathPopFrame(ctxt, frame);
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   136
 		    return (total);
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   137
 		}
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   138
-		for (i = 0; i < op->value; i++)
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   139
+		for (i = 0; i < op->value; i++) {
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   140
 		    if (ctxt->valueTab[(ctxt->valueNr - 1) - i] == NULL) {
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   141
 			xmlGenericError(xmlGenericErrorContext,
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   142
 				"xmlXPathCompOpEval: parameter error\n");
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   143
 			ctxt->error = XPATH_INVALID_OPERAND;
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   144
+			xmlXPathPopFrame(ctxt, frame);
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   145
 			return (total);
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   146
 		    }
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   147
+		}
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   148
                 if (op->cache != NULL)
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   149
                     XML_CAST_FPTR(func) = op->cache;
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   150
                 else {
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   151
@@ -13386,6 +13437,7 @@
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   152
                             xmlGenericError(xmlGenericErrorContext,
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   153
             "xmlXPathCompOpEval: function %s bound to undefined prefix %s\n",
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   154
                                     (char *)op->value4, (char *)op->value5);
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   155
+			    xmlXPathPopFrame(ctxt, frame);
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   156
                             return (total);
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   157
                         }
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   158
                         func = xmlXPathFunctionLookupNS(ctxt->context,
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   159
@@ -13407,6 +13459,7 @@
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   160
                 func(ctxt, op->value);
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   161
                 ctxt->context->function = oldFunc;
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   162
                 ctxt->context->functionURI = oldFuncURI;
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   163
+		xmlXPathPopFrame(ctxt, frame);
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   164
                 return (total);
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   165
             }
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   166
         case XPATH_OP_ARG:
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   167
@@ -14310,6 +14363,7 @@
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   168
 	ctxt->valueNr = 0;
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   169
 	ctxt->valueMax = 10;
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   170
 	ctxt->value = NULL;
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   171
+	ctxt->valueFrame = 0;
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   172
     }
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   173
 #ifdef XPATH_STREAMING
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   174
     if (ctxt->comp->stream) {
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   175
--- libxml2-2.7.6/include/libxml/xpath.h	Thu Sep 24 08:31:59 2009
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   176
+++ libxml2-2.7.6/include/libxml/new.xpath.h	Mon Oct 24 11:21:50 2011
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   177
@@ -68,7 +68,8 @@
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   178
     XPATH_UNDEF_PREFIX_ERROR,
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   179
     XPATH_ENCODING_ERROR,
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   180
     XPATH_INVALID_CHAR_ERROR,
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   181
-    XPATH_INVALID_CTXT
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   182
+    XPATH_INVALID_CTXT,
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   183
+    XPATH_STACK_ERROR
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   184
 } xmlXPathError;
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   185
 
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   186
 /*
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   187
@@ -380,6 +381,8 @@
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   188
     xmlXPathCompExprPtr comp;		/* the precompiled expression */
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   189
     int xptr;				/* it this an XPointer expression */
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   190
     xmlNodePtr         ancestor;	/* used for walking preceding axis */
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   191
+
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   192
+    int              valueFrame;	/* used to limit Pop on the stack */
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   193
 };
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   194
 
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   195
 /************************************************************************
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   196
--- libxml2-2.7.6/xpointer.c	Mon Oct 24 11:18:07 2011
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   197
+++ libxml2-2.7.6/new.xpointer.c	Mon Oct 24 11:42:52 2011
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   198
@@ -1269,6 +1269,7 @@
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   199
 	ctxt->valueNr = 0;
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   200
 	ctxt->valueMax = 10;
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   201
 	ctxt->value = NULL;
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   202
+	ctxt->valueFrame = 0;
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   203
     }
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   204
     SKIP_BLANKS;
c33a34e65bdb 7100337 Problem with library/libxml
Kevin Crowe <Kevin.Crowe@oracle.com>
parents:
diff changeset
   205
     if (CUR == '/') {
651
501e808038f6 7126712 xsltproc dies in xmlXPathReleaseObject with new patches
Kevin Crowe <Kevin.Crowe@oracle.com>
parents: 624
diff changeset
   206
501e808038f6 7126712 xsltproc dies in xmlXPathReleaseObject with new patches
Kevin Crowe <Kevin.Crowe@oracle.com>
parents: 624
diff changeset
   207
--- libxml2-2.7.6/xpath.c	Thu Jan  5 10:51:16 2012
501e808038f6 7126712 xsltproc dies in xmlXPathReleaseObject with new patches
Kevin Crowe <Kevin.Crowe@oracle.com>
parents: 624
diff changeset
   208
+++ libxml2-2.7.6/xpath.c.new	Thu Jan  5 11:00:39 2012
501e808038f6 7126712 xsltproc dies in xmlXPathReleaseObject with new patches
Kevin Crowe <Kevin.Crowe@oracle.com>
parents: 624
diff changeset
   209
@@ -11781,8 +11781,11 @@
501e808038f6 7126712 xsltproc dies in xmlXPathReleaseObject with new patches
Kevin Crowe <Kevin.Crowe@oracle.com>
parents: 624
diff changeset
   210
 		xmlXPathNodeSetAddUnique(contextObj->nodesetval,
501e808038f6 7126712 xsltproc dies in xmlXPathReleaseObject with new patches
Kevin Crowe <Kevin.Crowe@oracle.com>
parents: 624
diff changeset
   211
 		    contextNode);
501e808038f6 7126712 xsltproc dies in xmlXPathReleaseObject with new patches
Kevin Crowe <Kevin.Crowe@oracle.com>
parents: 624
diff changeset
   212
 
501e808038f6 7126712 xsltproc dies in xmlXPathReleaseObject with new patches
Kevin Crowe <Kevin.Crowe@oracle.com>
parents: 624
diff changeset
   213
+	    frame = xmlXPathSetFrame(ctxt);
501e808038f6 7126712 xsltproc dies in xmlXPathReleaseObject with new patches
Kevin Crowe <Kevin.Crowe@oracle.com>
parents: 624
diff changeset
   214
 	    valuePush(ctxt, contextObj);
501e808038f6 7126712 xsltproc dies in xmlXPathReleaseObject with new patches
Kevin Crowe <Kevin.Crowe@oracle.com>
parents: 624
diff changeset
   215
 	    res = xmlXPathCompOpEvalToBoolean(ctxt, exprOp, 1);
501e808038f6 7126712 xsltproc dies in xmlXPathReleaseObject with new patches
Kevin Crowe <Kevin.Crowe@oracle.com>
parents: 624
diff changeset
   216
+	    tmp = valuePop(ctxt);
501e808038f6 7126712 xsltproc dies in xmlXPathReleaseObject with new patches
Kevin Crowe <Kevin.Crowe@oracle.com>
parents: 624
diff changeset
   217
+	    xmlXPathPopFrame(ctxt, frame);
501e808038f6 7126712 xsltproc dies in xmlXPathReleaseObject with new patches
Kevin Crowe <Kevin.Crowe@oracle.com>
parents: 624
diff changeset
   218
 
501e808038f6 7126712 xsltproc dies in xmlXPathReleaseObject with new patches
Kevin Crowe <Kevin.Crowe@oracle.com>
parents: 624
diff changeset
   219
 	    if ((ctxt->error != XPATH_EXPRESSION_OK) || (res == -1)) {
501e808038f6 7126712 xsltproc dies in xmlXPathReleaseObject with new patches
Kevin Crowe <Kevin.Crowe@oracle.com>
parents: 624
diff changeset
   220
 		while (tmp != contextObj) {
501e808038f6 7126712 xsltproc dies in xmlXPathReleaseObject with new patches
Kevin Crowe <Kevin.Crowe@oracle.com>
parents: 624
diff changeset
   221