File large_eps_fix.patch of Package html2ps

From: Lauri Alanko <la@iki.fi>
Last-Update: 2003-05-18
Description: Fixes segmentation fault caused by large EPS
 Running html2ps on files with largish EPS images (using the --original
 option) can cause the program to segfault. After some examination with
 perl -d and gdb, it turned out that perl's regexp matching engine blows
 the stack with thousands of frames. The following trivial patch seems
 to fix the problem, and it also makes EPS handling noticeably faster

diff --git a/html2ps b/html2ps
index 45351d2..18d4d4d 100755
--- a/html2ps
+++ b/html2ps
@@ -4320,7 +4320,7 @@ sub img {
               push(@IT,1);
               $nli=30000;
               $n=1;
-              $npr=$ps=~s|(.*\n){$nli}|sprintf("$&} D\n/P$nimg\_%d {",$n++)|eg;
+              $npr=$ps=~s|(.*\n{$nli})|sprintf("$1} D\n/P$nimg\_%d {",$n++)|eg;
               if($npr) {
                 $proc=" (";
                 for $i (0..$npr) {
openSUSE Build Service is sponsored by