Bug 691289 - Ghostscript not able to render certain PDF files
Summary: Ghostscript not able to render certain PDF files
Status: RESOLVED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: PDF Interpreter (show other bugs)
Version: 8.71
Hardware: PC Linux
: P2 major
Assignee: Michael Vrhel
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-09 13:33 UTC by Till Kamppeter
Modified: 2010-12-31 18:14 UTC (History)
3 users (show)

See Also:
Customer:
Word Size: ---


Attachments
Offending PDF file from Ubuntu bug #577730 (81.06 KB, application/pdf)
2010-05-09 13:33 UTC, Till Kamppeter
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Till Kamppeter 2010-05-09 13:33:36 UTC
Created attachment 6270 [details]
Offending PDF file from Ubuntu bug #577730

The attached PDF file Ghostscript does not render, independent which output device gets used.

See the error message below. The same message appears when trying to convert the file to PostScript ("ps2pdf" script) or when trying to print the file and Ghostscript converts the file to the printer's language using a printer driver.

acroread and evince display the file without problems, also conversion to PostScript with Poppler ("pdftops") works (and Ghostscript then displays the Poppler-generated PostScript without problems).

Ghostscript is the one coming with Ubuntu Lucid, including the patches to fix bug 691014.

The original bug report is the following Ubuntu bug:

https://bugs.launchpad.net/bugs/577730

----------

till@till:~/ghostscript/gpl/testfiles$ gs lp577730-afdruk.pdf
GPL Ghostscript 8.71 (2010-02-10)
Copyright (C) 2010 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 1.
Page 1
Error: /rangecheck in --run--
Operand stack:
   --dict:7/16(L)--   1   11
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1878   1   3   %oparray_pop   1877   1   3   %oparray_pop   1861   1   3   %oparray_pop   --nostringval--   --nostringval--   2   1   1   --nostringval--   %for_pos_int_continue   --nostringval--   --nostringval--   false   1   %stopped_push   --nostringval--   --nostringval--
Dictionary stack:
   --dict:1153/1684(ro)(G)--   --dict:1/20(G)--   --dict:75/200(L)--   --dict:75/200(L)--   --dict:108/127(ro)(G)--   --dict:288/300(ro)(G)--   --dict:22/25(L)--   --dict:6/8(L)--   --dict:21/40(L)--   --dict:1/1(ro)(G)--   --dict:5/5(L)--   --dict:1/1(ro)(G)--
Current allocation mode is local
Last OS error: 11
GPL Ghostscript 8.71: Unrecoverable error, exit code 1
till@till:~/ghostscript/gpl/testfiles$
Comment 1 Ken Sharp 2010-05-09 14:26:16 UTC
Tried the file under Windows with 8.70, 8.71 and HEAD, all work. 

Tried HEAD under Fedora with the x11, ppmraw and pdfwrite devices, all work. The x11alpha device does give a 'rangecheck in run' error. I presume this is the well known problem with x11alpha and transparency. Since the PDF file is generated by Cairo it probably contains spurious transparency.

Yes, the 'image' object, presumably the logo at top right, is a Pattern which draws an image, drawn inside a form with a transparency group. Indeed, to add to the complexity, the page has a different transparency group etc.

I can't reproduce the problem with HEAD on Linux without using the x11alpha device though, so possibly the problem Till sees has been fixed?
Comment 2 Alex Cherepanov 2010-05-09 22:35:05 UTC
I can easily reproduce this problem on 64-bit GNU/Linux and
32-bit Windows. The problem first appears in rev. 10200.

r10200 | mvrhel | 2009-10-20 23:50:46 -0400 (Tue, 20 Oct 2009) | 72 lines
Reintegration of gs_extendgraphic branch into trunk.
Comment 3 Till Kamppeter 2010-05-09 23:01:16 UTC
Fails for me with HEAD on 32-bit Linux:

till@till-laptop:~/ghostscript/gpl/gs-test$ GS_LIB=lib:Resource/Init bin/gs -sDEVICE=png16m -sOutputFile=x.png ../testfiles/lp577730-afdruk.pdf 
GPL Ghostscript SVN PRE-RELEASE 8.72 (2010-02-11)
Copyright (C) 2010 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 1.
Page 1
Error: /rangecheck in --run--
Operand stack:
   --dict:7/16(L)--   File
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1894   1   3   %oparray_pop   1893   1   3   %oparray_pop   1877   1   3   %oparray_pop   --nostringval--   --nostringval--   2   1   1   --nostringval--   %for_pos_int_continue   --nostringval--   --nostringval--   false   1   %stopped_push   --nostringval--   --nostringval--
Dictionary stack:
   --dict:1157/1684(ro)(G)--   --dict:1/20(G)--   --dict:82/200(L)--   --dict:82/200(L)--   --dict:108/127(ro)(G)--   --dict:293/300(ro)(G)--   --dict:22/25(L)--   --dict:6/8(L)--   --dict:21/40(L)--   --dict:11/15(L)--   --dict:13/18(ro)(L)--   --dict:2/3(L)--   --dict:3/5(L)--   --dict:1/1(ro)(G)--   --dict:1/1(ro)(G)--   --dict:6/12(L)--
Current allocation mode is local
Last OS error: 2
GPL Ghostscript SVN PRE-RELEASE 8.72: Unrecoverable error, exit code 1
till@till-laptop:~/ghostscript/gpl/gs-test$
Comment 4 Till Kamppeter 2010-05-09 23:03:19 UTC
For the test of the previous comment I have built as follows:

CFLAGS="-fPIC" ./autogen.sh --prefix=/usr --sysconfdir=/etc --with-ijs --with-jbig2dec --with-jasper --with-x --disable-gtk --enable-dynamic --with-omni --enable-cups --disable-compile-inits --with-drivers=ALL --disable-cairo --with-fontpath=/var/lib/defoma/gs.d/dirs/fonts:/usr/share/cups/fonts:/usr/share/ghostscript/fonts:/usr/local/lib/ghostscript/fonts:/usr/share/fonts
make
Comment 5 Hin-Tak Leung 2010-05-10 04:38:28 UTC
I get the rangecheck error with pdfwrite (as well as x11alpha) with x86_64 linux with svn HEAD:

gs-r11211+fix -sDEVICE=pdfwrite -o a.pdf input.pdf
gs-r11212 -sDEVICE=pdfwrite -o a.pdf ...

So this is a different problem from bug 690487 (but probably still belongs to Michael according to Alex in comment 2).
Comment 6 Henry Stiles 2010-06-30 19:10:54 UTC
This should have been assigned to Michael on 5/9 given comment number 2.
Comment 7 Michael Vrhel 2010-07-15 04:49:31 UTC
I have started to look at this. Rangecheck occurs with execution of zdiscardtransparencygroup which indicates we are losing track or mixing up our groups.  Likely this is caused by the pattern with the transparency and our tracking of the softmask stack.  Error happens for me with tiff24nc and pdfwrite on win32.   Working on creating a simplified file.
Comment 8 Alex Cherepanov 2010-12-31 18:14:11 UTC
The problem can be reproduced in v. 8.71 but it is fixed
in v. 9.00 and the current HEAD.