0007-EXSLT-function-str-replace-is-broken-as-is.patch 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. From: Nick Wellnhofer <wellnhofer@aevum.de>
  2. Date: Mon, 1 Jul 2013 13:10:10 +0000
  3. Subject: EXSLT function str:replace() is broken as-is
  4. the str:replace() function is no longer usable without a transform
  5. context. I take it from the bug report that it is not supposed to be used
  6. from plain XPath but only from XSLT according to the EXSLT specification.
  7. However, the previous implementation used to work in XPath and is still
  8. registered on an xmlXPathContext by the exsltStrXpathCtxtRegister()
  9. function. When called from plain XPath, it results in a memory error in
  10. line 526 (exsltStrReturnString()) of strings.c because xsltCreateRVT()
  11. returns NULL as an error indicator due to a NULL transform context being
  12. passed in, which was the return value from xsltXPathGetTransformContext() a
  13. bit further up (and the code doesn't validate that).
  14. Since fixing the function looks impossible, best is to remove it.
  15. ---
  16. libexslt/strings.c | 6 +-----
  17. 1 file changed, 1 insertion(+), 5 deletions(-)
  18. diff --git a/libexslt/strings.c b/libexslt/strings.c
  19. index 045cc14..c0c7a18 100644
  20. --- a/libexslt/strings.c
  21. +++ b/libexslt/strings.c
  22. @@ -838,11 +838,7 @@ exsltStrXpathCtxtRegister (xmlXPathContextPtr ctxt, const xmlChar *prefix)
  23. && !xmlXPathRegisterFuncNS(ctxt,
  24. (const xmlChar *) "concat",
  25. (const xmlChar *) EXSLT_STRINGS_NAMESPACE,
  26. - exsltStrConcatFunction)
  27. - && !xmlXPathRegisterFuncNS(ctxt,
  28. - (const xmlChar *) "replace",
  29. - (const xmlChar *) EXSLT_STRINGS_NAMESPACE,
  30. - exsltStrReplaceFunction)) {
  31. + exsltStrConcatFunction)) {
  32. return 0;
  33. }
  34. return -1;