Skip to content

Commit

Permalink
Fix missing error status in XPath evaluation
Browse files Browse the repository at this point in the history
Started by Chris Evans, I added a few more place where the
error should have been set in the evaluation context.
  • Loading branch information
veillard committed Oct 11, 2011
1 parent f1da8ab commit 1d4526f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions xpath.c
Original file line number Diff line number Diff line change
Expand Up @@ -2485,6 +2485,7 @@ valuePush(xmlXPathParserContextPtr ctxt, xmlXPathObjectPtr value)
sizeof(ctxt->valueTab[0]));
if (tmp == NULL) {
xmlGenericError(xmlGenericErrorContext, "realloc failed !\n");
ctxt->error = XPATH_MEMORY_ERROR;
return (0);
}
ctxt->valueMax *= 2;
Expand Down Expand Up @@ -9340,13 +9341,15 @@ xmlXPathTranslateFunction(xmlXPathParserContextPtr ctxt, int nargs) {
if ( (ch & 0xc0) != 0xc0 ) {
xmlGenericError(xmlGenericErrorContext,
"xmlXPathTranslateFunction: Invalid UTF8 string\n");
/* not asserting an XPath error is probably better */
break;
}
/* then skip over remaining bytes for this char */
while ( (ch <<= 1) & 0x80 )
if ( (*cptr++ & 0xc0) != 0x80 ) {
xmlGenericError(xmlGenericErrorContext,
"xmlXPathTranslateFunction: Invalid UTF8 string\n");
/* not asserting an XPath error is probably better */
break;
}
if (ch & 0x80) /* must have had error encountered */
Expand Down Expand Up @@ -13410,6 +13413,7 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
xmlGenericError(xmlGenericErrorContext,
"xmlXPathCompOpEval: variable %s bound to undefined prefix %s\n",
(char *) op->value4, (char *)op->value5);
ctxt->error = XPATH_UNDEF_PREFIX_ERROR;
return (total);
}
val = xmlXPathVariableLookupNS(ctxt->context,
Expand Down Expand Up @@ -13464,6 +13468,7 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
"xmlXPathCompOpEval: function %s bound to undefined prefix %s\n",
(char *)op->value4, (char *)op->value5);
xmlXPathPopFrame(ctxt, frame);
ctxt->error = XPATH_UNDEF_PREFIX_ERROR;
return (total);
}
func = xmlXPathFunctionLookupNS(ctxt->context,
Expand Down Expand Up @@ -14042,6 +14047,7 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
}
xmlGenericError(xmlGenericErrorContext,
"XPath: unknown precompiled operation %d\n", op->op);
ctxt->error = XPATH_INVALID_OPERAND;
return (total);
}

Expand Down

0 comments on commit 1d4526f

Please sign in to comment.