File: large_eps_fix.patch

package info (click to toggle)
html2ps 1.0b7-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,208 kB
  • sloc: perl: 4,539; tcl: 1,799; sh: 38; makefile: 4
file content (22 lines) | stat: -rw-r--r-- 922 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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) {