Bug 692200

Summary: Regression: Extracting pages from pdf fails with documents that contain internal links
Product: Ghostscript Reporter: Marcos H. Woehrmann <marcos.woehrmann>
Component: PDF WriterAssignee: Ken Sharp <ken.sharp>
Status: NOTIFIED FIXED    
Severity: normal CC: alex
Priority: P2    
Version: master   
Hardware: PC   
OS: All   
Customer: 580 Word Size: ---
Attachments: SampleTest.pdf
patch

Description Marcos H. Woehrmann 2011-05-09 19:07:52 UTC
The customer reported and I've verified that Ghostscript 9.00 and later versions produce an output file with only two pages before producing an error:

.
.
.
   **** Warning: Outline has invalid link that was discarded.
   **** Warning: Outline has invalid link that was discarded.
   **** Warning: Outline has invalid link that was discarded.
Processing pages 1 through 11.
Page 1
Loading NimbusSanL-Bold font from %rom%Resource/Font/NimbusSanL-Bold... 3949272 2608374 2932520 1629526 3 done.
Loading NimbusSanL-Regu font from %rom%Resource/Font/NimbusSanL-Regu... 4063288 2732835 2952704 1645770 3 done.
Page 2
Loading NimbusRomNo9L-Regu font from %rom%Resource/Font/NimbusRomNo9L-Regu... 4265976 2932777 3134360 1821058 3 done.
Page 3
Error: /rangecheck in 12
Operand stack:
   --dict:9/18(L)--   --nostringval--   --nostringval--   Rect   --nostringval--   Border   --nostringval--   --dict:5/5(L)--   --nostringval--   --nostringval--   0
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   --nostringval--   --nostringval--   4   1   11   --nostr
ingval--   %for_pos_int_continue   --nostringval--   --nostringval--   11   1   37   --nostringval--   %for_pos_int_continue   --nostringval--   --nostringval--   --n
ostringval--
Dictionary stack:
   --dict:1160/1684(ro)(G)--   --dict:1/20(G)--   --dict:82/200(L)--   --dict:82/200(L)--   --dict:108/127(ro)(G)--   --dict:292/300(ro)(G)--   --dict:23/30(L)--
Current allocation mode is local
Last OS error: 2
GPL Ghostscript GIT PRERELEASE 9.03: Unrecoverable error, exit code 1
GPL Ghostscript GIT PRERELEASE 9.03: ERROR: A pdfmark destination page 11 points beyond the last page 2.
GPL Ghostscript GIT PRERELEASE 9.03: Unrecoverable error, exit code 1

Ghostscript versions before 410f6cf8ac98aeb66459e3ecb495e3f1024a47e9 fail with a different error message but produce the correct output.

There is the command line the customer is using:

gswin32c -sDEVICE=pdfwrite -o out.pdf  -dFirstPage=1 -dLastPage=11 SampleTest.pdf
Comment 1 Marcos H. Woehrmann 2011-05-09 19:08:15 UTC
Created attachment 7499 [details]
SampleTest.pdf
Comment 2 Alex Cherepanov 2011-05-10 05:23:51 UTC
Created attachment 7500 [details]
patch

Execute linkdest procedure in a stopped context to trap errors caused
by out-of-range link destinations that can occur in an invalid files or
during processing of a page range.
Comment 3 Ken Sharp 2011-05-10 07:08:41 UTC
(In reply to comment #2)
> Created an attachment (id=7500) [details]
> patch
> 
> Execute linkdest procedure in a stopped context to trap errors caused
> by out-of-range link destinations that can occur in an invalid files or
> during processing of a page range.

Alex committed this patch in g0f59283:

http://ghostscript.com/pipermail/gs-cvs/2011-May/012884.html

Alex, should we close this bug ? (Thanks for looking at it by the way)