libxml2-7-error-xpath.patch 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. From 1d4526f6f4ec8d18c40e2a09b387652a6c1aa2cd Mon Sep 17 00:00:00 2001
  2. From: Daniel Veillard <veillard@redhat.com>
  3. Date: Tue, 11 Oct 2011 08:34:34 +0000
  4. Subject: Fix missing error status in XPath evaluation
  5. Started by Chris Evans, I added a few more place where the
  6. error should have been set in the evaluation context.
  7. ---
  8. diff --git a/xpath.c b/xpath.c
  9. index bcee2ea..d9d902c 100644
  10. --- a/xpath.c
  11. +++ b/xpath.c
  12. @@ -2485,6 +2485,7 @@ valuePush(xmlXPathParserContextPtr ctxt, xmlXPathObjectPtr value)
  13. sizeof(ctxt->valueTab[0]));
  14. if (tmp == NULL) {
  15. xmlGenericError(xmlGenericErrorContext, "realloc failed !\n");
  16. + ctxt->error = XPATH_MEMORY_ERROR;
  17. return (0);
  18. }
  19. ctxt->valueMax *= 2;
  20. @@ -9340,6 +9341,7 @@ xmlXPathTranslateFunction(xmlXPathParserContextPtr ctxt, int nargs) {
  21. if ( (ch & 0xc0) != 0xc0 ) {
  22. xmlGenericError(xmlGenericErrorContext,
  23. "xmlXPathTranslateFunction: Invalid UTF8 string\n");
  24. + /* not asserting an XPath error is probably better */
  25. break;
  26. }
  27. /* then skip over remaining bytes for this char */
  28. @@ -9347,6 +9349,7 @@ xmlXPathTranslateFunction(xmlXPathParserContextPtr ctxt, int nargs) {
  29. if ( (*cptr++ & 0xc0) != 0x80 ) {
  30. xmlGenericError(xmlGenericErrorContext,
  31. "xmlXPathTranslateFunction: Invalid UTF8 string\n");
  32. + /* not asserting an XPath error is probably better */
  33. break;
  34. }
  35. if (ch & 0x80) /* must have had error encountered */
  36. @@ -13410,6 +13413,7 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
  37. xmlGenericError(xmlGenericErrorContext,
  38. "xmlXPathCompOpEval: variable %s bound to undefined prefix %s\n",
  39. (char *) op->value4, (char *)op->value5);
  40. + ctxt->error = XPATH_UNDEF_PREFIX_ERROR;
  41. return (total);
  42. }
  43. val = xmlXPathVariableLookupNS(ctxt->context,
  44. @@ -13464,6 +13468,7 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
  45. "xmlXPathCompOpEval: function %s bound to undefined prefix %s\n",
  46. (char *)op->value4, (char *)op->value5);
  47. xmlXPathPopFrame(ctxt, frame);
  48. + ctxt->error = XPATH_UNDEF_PREFIX_ERROR;
  49. return (total);
  50. }
  51. func = xmlXPathFunctionLookupNS(ctxt->context,
  52. @@ -14042,6 +14047,7 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
  53. }
  54. xmlGenericError(xmlGenericErrorContext,
  55. "XPath: unknown precompiled operation %d\n", op->op);
  56. + ctxt->error = XPATH_INVALID_OPERAND;
  57. return (total);
  58. }
  59. --
  60. cgit v0.9.0.2