Bug 693522

Summary: pdfopt: crash on some input PDF file
Product: Ghostscript Reporter: roucaries.bastien+gs
Component: PDF InterpreterAssignee: Alex Cherepanov <alex>
Status: RESOLVED WONTFIX    
Severity: minor CC: till.kamppeter
Priority: P4    
Version: master   
Hardware: PC   
OS: Linux   
Customer: Word Size: ---
Attachments: Fail to pdfopt file

Description roucaries.bastien+gs 2012-12-31 10:47:35 UTC
Created attachment 9174 [details]
Fail to pdfopt file

According to one of our debian user was hit by an old bug
(see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=696417)

Even with recent version 9.05

I was trying to compress a PDF file generated from my HP/Scanner. The file is reported as:

$ pdfinfo
Title:          /tmp/simple-scan-J7U3PW.pdf
Producer:       ImageMagick 6.6.0-4 2012-05-02 Q16 http://www.imagemagick.org
CreationDate:   Thu Dec 20 15:36:45 2012
ModDate:        Thu Dec 20 15:36:45 2012
Tagged:         no
Pages:          1
Encrypted:      no
Page size:      611.76 x 841.44 pts
File size:      1715008 bytes
Optimized:      no
PDF version:    1.3

This PDF makes pdfopt crashes with:

Error: /typecheck in --setfileposition--
Operand stack:
   --nostringval--   13   0   1714253   13   1714253   77   3348   --nostringval--   --nostringval--
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1910   1   3   %oparray_pop   1909   1   3   %oparray_pop   1893   1   3   %oparray_pop   1787   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   --nostringval--   --nostringval--   1711312   --nostringval--   --nostringval--   %array_continue   --nostringval--   --nostringval--   %array_continue   --nostringval--
Dictionary stack:
   --dict:1163/1684(ro)(G)--   --dict:1/20(G)--   --dict:116/200(L)--   --dict:76/200(G)--   --dict:291/300(ro)(G)--   --dict:20/31(L)--   --dict:37/40(L)--
Current allocation mode is local
Last OS error: No such file or directory
Current file position is 38334
GPL Ghostscript 9.05: Unrecoverable error, exit code 1


There is one easy way to reproduce with any PDF generated by imagemagick:

$ sudo apt-get install imagemagick
$ convert -size 611x841 xc:white test.pdf

I am attaching test.pdf to this bug report, just in case.
Comment 1 Ken Sharp 2013-01-01 09:20:07 UTC
pdfopt is obselete, and no longer supported. We don't believe it ever worked properly and there are so many bugs it isn't reasonable to try and fix them.

As of the next release the pdfwrite device has a 'FastWebView' switch which enables production of Linearised PDF files (the switch defaults to off).