Bug 692177 - Error: /rangecheck in --run--
Summary: Error: /rangecheck in --run--
Status: NOTIFIED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: PDF Interpreter (show other bugs)
Version: master
Hardware: PC All
: P2 normal
Assignee: Alex Cherepanov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-02 15:29 UTC by Marcos H. Woehrmann
Modified: 2011-11-25 04:46 UTC (History)
0 users

See Also:
Customer: 353
Word Size: ---


Attachments
patch (2.56 KB, patch)
2011-05-04 04:54 UTC, Alex Cherepanov
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marcos H. Woehrmann 2011-05-02 15:29:23 UTC
The customer reports and I've verified that Ghostscript cannot read the attached PDF file, producing a "Error: /rangecheck in --run--" error.  All version of Ghostscript that I tried, from 8.53 to head (5091054103f3b07bbae8ab2fc75e6c6cc3fd7a86) produce the same error.

Apple Preview 5.0.3 as well as Acrobat 8.2.6, 9.4.4, and 10.0.3 read the file without problem, mupdf produces an error (see separate mupdf bug for details).

The command line I'm using for testing:

  bin/gs -sDEVICE=ppmraw -o test.ppm ./Origina.pdf


The customer reports: Looking the content of this PDF file, it appears that it makes use of a very uncommon xref encoding but which matches the PDF Reference
Comment 2 Marcos H. Woehrmann 2011-05-02 15:31:15 UTC
Here's the very terse -dPDFDEBUG output:

marcos@macbookpro:[33]% gsheadppm  -dPDFDEBUG ./Original.pdf 
GPL Ghostscript GIT PRERELEASE 9.03 (2011-03-30)
Copyright (C) 2010 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
<<
/Size 1622 /Info 2 0 R
/Root 1 0 R
/Prev 2193476 /ID [
(\207"/\230\016\272\265\\H\(\353\032,A\342\270) (\207"/\230\016\272\265\\H\(\353\032,A\342\270) ]
/Lambkin (ccbadhe) >>
   **** Warning:  An error occurred while reading an XREF table.
   **** The file has been damaged.  This may have been caused
   **** by a problem while converting or transfering the file.
   **** Ghostscript will attempt to recover the data.
%Resolving: [1 0]
Error: /rangecheck in --run--
Operand stack:
   1   0   1   --nostringval--   1
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--   --nostringval--   --nostringval--   --nostringval--   --nostringval--   --nostringval--
Dictionary stack:
   --dict:1152/1684(ro)(G)--   --dict:1/20(G)--   --dict:82/200(L)--   --dict:82/200(L)--   --dict:108/127(ro)(G)--   --dict:295/300(ro)(G)--   --dict:21/30(L)--
Current allocation mode is local
GPL Ghostscript GIT PRERELEASE 9.03: Unrecoverable error, exit code 1
Exit 1
marcos@macbookpro:[34]%
Comment 3 Marcos H. Woehrmann 2011-05-02 17:27:22 UTC
As of 45bf62dc4e7271c25ee53e1e2ce0de51955132de this file now works in mupdf:

    pdf_repair.c: Skip first comment after version marker.
    
    Some particularly broken generators forget to terminate the
    comment with a newline. Skip the comment character so we'll
    get some garbage tokens that we can ignore, rather than
    consuming the innocent objects that follow on the same line
    as the %.
Comment 4 Alex Cherepanov 2011-05-03 16:00:32 UTC
Ghostscript can run the file if
"xref 0 837 0000000000 65535 f  0000124513 00000 n ..."
is replaced with
"xref 0 837"
"0000000000 65535 f  0000124513 00000 n ..."
Of course, xref should be terminated by a new line but gs can handle this.

The sample file produced by "pcl convert 2.10" is full of bugs.
Perhaps, there are better tools to convert PCL to PDF.
Comment 5 Alex Cherepanov 2011-05-04 04:54:41 UTC
Created attachment 7486 [details]
patch

Accept and skip any number of whitespace characters (including just spaces)
after the entry count in the xref table. Remove /lineeq and /linene procedures
that are no longer used.
Comment 6 Alex Cherepanov 2011-05-04 04:56:18 UTC
The patch has been committed as a rev.
2f0b609805f1abf42b4b10dd721d9fef3001a847