Package: libpoppler3 Version: 0.8.7-2 Severity: normal
Poppler in lenny needs the following patch (pulled from Ubuntu intrepid) to produce correct PostScript output from some PDFs. Without it, it'll produce PostScript that'll cause gs to choke with "/limitcheck in --array--". See: https://launchpad.net/bugs/311982 Patch is named 63_do-not-make-ps-arrays-bigger-than-64k-from-big-images-in-patterns.patch in Intrepid's poppler sources. This patch is not required for libpoppler4 in testing, as upstream have fixed the issue. diff -Nur -x '*.orig' -x '*~' poppler-0.8.7/poppler/PSOutputDev.cc poppler-0.8.7.new/poppler/PSOutputDev.cc --- poppler-0.8.7/poppler/PSOutputDev.cc 2008-06-01 16:35:25.000000000 +0200 +++ poppler-0.8.7.new/poppler/PSOutputDev.cc 2009-01-02 14:20:25.000000000 +0100 @@ -2591,6 +2591,7 @@ GooString *s; int c; int size, line, col, i; + int outerSize, outer; // check if image is already setup for (i = 0; i < imgIDLen; ++i) { @@ -2677,56 +2678,72 @@ if (useRLE) { ++size; } + outerSize = size/65535 + 1; + writePSFmt("{0:d} array dup /ImData_{1:d}_{2:d} exch def\n", - size, id.num, id.gen); + outerSize, id.num, id.gen); str->close(); // write the data into the array str->reset(); - line = col = 0; - writePS((char *)(useASCIIHex ? "dup 0 <" : "dup 0 <~")); - do { - do { - c = str->getChar(); - } while (c == '\n' || c == '\r'); - if (c == (useASCIIHex ? '>' : '~') || c == EOF) { - break; - } - if (c == 'z') { - writePSChar(c); - ++col; - } else { - writePSChar(c); - ++col; - for (i = 1; i <= (useASCIIHex ? 1 : 4); ++i) { - do { - c = str->getChar(); - } while (c == '\n' || c == '\r'); - if (c == (useASCIIHex ? '>' : '~') || c == EOF) { - break; - } + for (outer = 0;outer < outerSize;outer++) { + int innerSize = size > 65535 ? 65535 : size; + + // put the inner array into the outer array + writePSFmt("{0:d} array 1 index {1:d} 2 index put\n", + innerSize, outer); + line = col = 0; + writePS((char *)(useASCIIHex ? "dup 0 <" : "dup 0 <~")); + for (;;) { + do { + c = str->getChar(); + } while (c == '\n' || c == '\r'); + if (c == (useASCIIHex ? '>' : '~') || c == EOF) { + break; + } + if (c == 'z') { writePSChar(c); ++col; + } else { + writePSChar(c); + ++col; + for (i = 1; i <= (useASCIIHex ? 1 : 4); ++i) { + do { + c = str->getChar(); + } while (c == '\n' || c == '\r'); + if (c == (useASCIIHex ? '>' : '~') || c == EOF) { + break; + } + writePSChar(c); + ++col; + } + } + // each line is: "dup nnnnn <~...data...~> put<eol>" + // so max data length = 255 - 20 = 235 + // chunks are 1 or 4 bytes each, so we have to stop at 232 + // but make it 225 just to be safe + if (col > 225) { + writePS((char *)(useASCIIHex ? "> put\n" : "~> put\n")); + ++line; + if (line >= innerSize) break; + writePSFmt((char *)(useASCIIHex ? "dup {0:d} <" : "dup {0:d} <~"), line); + col = 0; } } - // each line is: "dup nnnnn <~...data...~> put<eol>" - // so max data length = 255 - 20 = 235 - // chunks are 1 or 4 bytes each, so we have to stop at 232 - // but make it 225 just to be safe - if (col > 225) { + if (c == (useASCIIHex ? '>' : '~') || c == EOF) { writePS((char *)(useASCIIHex ? "> put\n" : "~> put\n")); - ++line; - writePSFmt((char *)(useASCIIHex ? "dup {0:d} <" : "dup {0:d} <~"), line); - col = 0; + if (useRLE) { + ++line; + writePSFmt("{0:d} <> put\n", line); + } else { + writePS("pop\n"); + } + break; } - } while (c != (useASCIIHex ? '>' : '~') && c != EOF); - writePS((char *)(useASCIIHex ? "> put\n" : "~> put\n")); - if (useRLE) { - ++line; - writePSFmt("{0:d} <> put\n", line); - } else { writePS("pop\n"); + size -= innerSize; } + writePS("pop\n"); str->close(); delete str; @@ -4361,7 +4378,7 @@ delete str; } else { // set up to use the array already created by setupImages() - writePSFmt("ImData_{0:d}_{1:d} 0\n", ref->getRefNum(), ref->getRefGen()); + writePSFmt("ImData_{0:d}_{1:d} 0 0\n", ref->getRefNum(), ref->getRefGen()); } } @@ -4822,7 +4839,7 @@ delete str2; } else { // set up to use the array already created by setupImages() - writePSFmt("ImData_{0:d}_{1:d} 0\n", ref->getRefNum(), ref->getRefGen()); + writePSFmt("ImData_{0:d}_{1:d} 0 0\n",ref->getRefNum(), ref->getRefGen()); } } @@ -4876,7 +4893,12 @@ // data source if (mode == psModeForm || inType3Char || preload) { - writePS(" /DataSource { 2 copy get exch 1 add exch }\n"); + if (inlineImg) { + writePS(" /DataSource { 2 copy get exch 1 add exch }\n"); + } else { + writePS(" /DataSource { dup 65535 ge { pop 1 add 0 } if 2 index 2" + " index get 1 index get exch 1 add exch }\n"); + } } else { writePS(" /DataSource currentfile\n"); } @@ -4915,6 +4937,7 @@ writePSFmt(">>\n{0:s}\n", colorMap ? "image" : "imagemask"); // get rid of the array and index + if (!inlineImg) writePS("pop "); writePS("pop pop\n"); } else { @@ -5090,7 +5113,7 @@ delete str2; } else { // set up to use the array already created by setupImages() - writePSFmt("ImData_{0:d}_{1:d} 0\n", ref->getRefNum(), ref->getRefGen()); + writePSFmt("ImData_{0:d}_{1:d} 0 0\n", ref->getRefNum(), ref->getRefGen()); } } @@ -5161,7 +5184,12 @@ // data source if (mode == psModeForm || inType3Char || preload) { - writePS(" /DataSource { 2 copy get exch 1 add exch }\n"); + if (inlineImg) { + writePS(" /DataSource { 2 copy get exch 1 add exch }\n"); + } else { + writePS(" /DataSource { dup 65535 ge { pop 1 add 0 } if 2 index 2" + " index get 1 index get exch 1 add exch }\n"); + } } else { writePS(" /DataSource currentfile\n"); } @@ -5297,6 +5325,7 @@ // get rid of the array and index if (mode == psModeForm || inType3Char || preload) { + if (!inlineImg) writePS("pop "); writePS("pop pop\n"); // image data -- System Information: Debian Release: 5.0.2 APT prefers stable APT policy: (500, 'stable') Architecture: i386 (i686) Kernel: Linux 2.6.18-5-686 (SMP w/1 CPU core) Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash Versions of packages libpoppler3 depends on: ii libc6 2.7-18 GNU C Library: Shared libraries ii libfontconfig1 2.6.0-3 generic font configuration library ii libfreetype6 2.3.7-2+lenny1 FreeType 2 font engine, shared lib ii libgcc1 1:4.3.2-1.1 GCC support library ii libjpeg62 6b-14 The Independent JPEG Group's JPEG ii libstdc++6 4.3.2-1.1 The GNU Standard C++ Library v3 ii libxml2 2.6.32.dfsg-5 GNOME XML library ii zlib1g 1:1.2.3.3.dfsg-12 compression library - runtime libpoppler3 recommends no packages. libpoppler3 suggests no packages. -- no debconf information -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org