0014-Fix-XPath-stack-frame-logic.patch 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. From: Nick Wellnhofer <wellnhofer@aevum.de>
  2. Date: Thu, 1 Jun 2017 23:12:19 +0200
  3. Subject: Fix XPath stack frame logic
  4. Origin: https://git.gnome.org/browse/libxml2/commit/?id=0f3b843b3534784ef57a4f9b874238aa1fda5a73
  5. Bug-Debian: https://bugs.debian.org/883790
  6. Bug: https://bugzilla.gnome.org/show_bug.cgi?id=783160
  7. Bug-Debian-Security: https://security-tracker.debian.org/tracker/CVE-2017-15412
  8. Move the calls to xmlXPathSetFrame and xmlXPathPopFrame around in
  9. xmlXPathCompOpEvalPositionalPredicate to make sure that the context
  10. object on the stack is actually protected. Otherwise, memory corruption
  11. can occur when calling sloppily coded XPath extension functions.
  12. Fixes bug 783160.
  13. ---
  14. xpath.c | 4 ++--
  15. 1 file changed, 2 insertions(+), 2 deletions(-)
  16. diff --git a/xpath.c b/xpath.c
  17. index 94815075..b816bd36 100644
  18. --- a/xpath.c
  19. +++ b/xpath.c
  20. @@ -11932,11 +11932,11 @@ xmlXPathCompOpEvalPositionalPredicate(xmlXPathParserContextPtr ctxt,
  21. }
  22. }
  23. - frame = xmlXPathSetFrame(ctxt);
  24. valuePush(ctxt, contextObj);
  25. + frame = xmlXPathSetFrame(ctxt);
  26. res = xmlXPathCompOpEvalToBoolean(ctxt, exprOp, 1);
  27. - tmp = valuePop(ctxt);
  28. xmlXPathPopFrame(ctxt, frame);
  29. + tmp = valuePop(ctxt);
  30. if ((ctxt->error != XPATH_EXPRESSION_OK) || (res == -1)) {
  31. while (tmp != contextObj) {
  32. --
  33. 2.15.1