Bug 691502

Summary: Regression: damaged PDF file cannot be read starting with r11392
Product: Ghostscript Reporter: Marcos H. Woehrmann <marcos.woehrmann>
Component: PDF InterpreterAssignee: Alex Cherepanov <alex>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P4    
Version: master   
Hardware: PC   
OS: All   
Customer: Word Size: ---
Attachments: patch

Description Marcos H. Woehrmann 2010-07-26 21:15:11 UTC
Starting with r11392 the attached PDF file cannot be read by Ghostscript.  Earlier versions read the file with this warning:

   **** Warning:  File has an invalid xref entry:  7.  Rebuilding xref table.

Later versions, including head, produce:

GPL Ghostscript SVN PRE-RELEASE 9.00 (2010-07-31)
Copyright (C) 2010 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
   **** Warning:  File has an invalid xref entry:  7.  Rebuilding xref table.
   **** Warning:  There are objects with matching object and generation
   **** numbers.  The accuracy of the resulting image is unknown.
Processing pages 1 through 1.
Page 1
   **** Unrecoverable error in xref!
Error: /rangecheck in resolveR
Operand stack:
   --dict:8/17(L)--   --dict:10/18(L)--   637   --nostringval--   --nostringval--   637   12   0
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--   --nostringval--   --nostringval--   %array_continue   --nostringval--   false   1   %stopped_push   --nostringval--   %loop_continue   --nostringval--   637   --nostringval--   --nostringval--   --nostringval--   --nostringval--   --nostringval--   --nostringval--
Dictionary stack:
   --dict:1151/1684(ro)(G)--   --dict:1/20(G)--   --dict:82/200(L)--   --dict:82/200(L)--   --dict:108/127(ro)(G)--   --dict:290/300(ro)(G)--   --dict:24/25(L)--   --dict:6/8(L)--   --dict:22/40(L)--   --dict:1/1(ro)(G)--   --dict:1/1(ro)(G)--   --dict:1/1(ro)(G)--   --dict:5/16(L)--
Current allocation mode is local
Last OS error: 2
GPL Ghostscript SVN PRE-RELEASE 9.00: Unrecoverable error, exit code 1
Exit 1



The command line I'm using for testing:

  bin/s -sDEVICE=ppmraw -o test.ppm ./damagedxref.pdf
Comment 2 Alex Cherepanov 2010-08-02 21:32:00 UTC
Created attachment 6595 [details]
patch

Partly revert rev. 11392 that over-simplified the check for a valid obj line
in the PDF file. Use --search-- to reject impossible cases but revert to the
old logic to verify the results.
Comment 3 Alex Cherepanov 2010-08-02 21:33:13 UTC
The patch has been committed as a rev. 11590.