docbook-xsl-nons-1.79.2-stack_fix-1.patch 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. Submitted By: Bruce Dubbs <bdubbs at linuxfromscratch dot org>
  2. Date: 2018-01-01
  3. Initial Package Version: 1.78.1
  4. Upstream Status: Unsure
  5. Origin: Peter De Wachter <pdewacht@gmail.com>
  6. Description: use EXSLT "replace" function when available
  7. A recursive implementation of string.subst is problematic,
  8. long strings with many matches will cause stack overflows.
  9. Author: Peter De Wachter <pdewacht@gmail.com>
  10. Bug-Debian: https://bugs.debian.org/750593
  11. Rediffed for 1.79.2 by Bruce Dubbs
  12. diff -Naur docbook-xsl-1.79.2.orig/lib/lib.xsl docbook-xsl-1.79.2/lib/lib.xsl
  13. --- docbook-xsl-1.79.2.orig/lib/lib.xsl 2016-12-09 16:41:39.000000000 -0600
  14. +++ docbook-xsl-1.79.2/lib/lib.xsl 2018-01-01 12:54:52.507332514 -0600
  15. @@ -6,7 +6,11 @@
  16. This module implements DTD-independent functions
  17. - ******************************************************************** --><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  18. + ******************************************************************** -->
  19. +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  20. + xmlns:str="http://exslt.org/strings"
  21. + exclude-result-prefixes="str"
  22. + version="1.0">
  23. <xsl:template name="dot.count">
  24. <!-- Returns the number of "." characters in a string -->
  25. @@ -52,6 +56,9 @@
  26. <xsl:param name="replacement"/>
  27. <xsl:choose>
  28. + <xsl:when test="function-available('str:replace')">
  29. + <xsl:value-of select="str:replace($string, string($target), string($replacement))"/>
  30. + </xsl:when>
  31. <xsl:when test="contains($string, $target)">
  32. <xsl:variable name="rest">
  33. <xsl:call-template name="string.subst">