Bug 691539 - Regression: /rangecheck in 3 with pdfwrite starting with r11595
Summary: Regression: /rangecheck in 3 with pdfwrite starting with r11595
Status: RESOLVED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: Regression (show other bugs)
Version: master
Hardware: PC All
: P1 normal
Assignee: Alex Cherepanov
URL:
Keywords:
: 691722 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-08-08 18:38 UTC by Marcos H. Woehrmann
Modified: 2011-06-28 01:29 UTC (History)
4 users (show)

See Also:
Customer:
Word Size: ---


Attachments
partial patch (1.04 KB, patch)
2010-08-09 02:36 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 2010-08-08 18:38:17 UTC
Starting with tr11595 Ghostscript generates an "Error: /rangecheck in 3" with the following command line:

  ./bin/gs -sDEVICE=pdfwrite -o test.pdf -dLastPage=1 ./RodinCIDEmbed.pdf
Comment 1 Alex Cherepanov 2010-08-09 02:35:45 UTC
Rev. 11595 has a few problems, which I missed during the review.
1. signalerror takes 2 operands.
2. not all calls to linkdest were in the stopped context.

My patch is incomplete because the error message it prints is false.
The user doesn't need to "notify the author of the software" because the
PDF is fine. We just view it in an unusual way. I didn't yet figure out
how to fix this.

It is possible to check whether the page is within a valid range
(1..PageCount) and throw a different error. Later one can print different
messages depending on the operator name that throws the error. 
I hope there are better ways to do this.
Comment 2 Alex Cherepanov 2010-08-09 02:36:37 UTC
Created attachment 6633 [details]
partial patch
Comment 3 Ken Sharp 2010-08-11 12:50:54 UTC
Alex, are you still looking at this, or want me to take it back ?
Comment 4 Ken Sharp 2010-10-26 16:52:40 UTC
*** Bug 691722 has been marked as a duplicate of this bug. ***
Comment 5 Philippe Lang 2010-10-27 06:51:43 UTC
I'm not sure if it will help, but Ghostscript 8.71 is able to extract page 2 of the document I uploaded with Bug 691722, when Ghostscript 9.0 fails. Ghostscript 8.71 mentions an error, though:

GPL Ghostscript 8.71: ERROR: A pdfmark destination page 13 points beyond the last page 1.

The gs output is fine, even with this error.
Comment 6 Ken Sharp 2010-10-27 07:40:28 UTC
The fix in revision 11595 was intended to remove pdfmarks which point to pages which are outside the FirstPage/LastPage range, so that we don't produce PDF files with incorrect destinations.

Prior to this (eg GS 8.71) the destination could be written to the output file, but since this revision is the one introducing the problem, the file would otherwise work.
Comment 7 Ken Sharp 2011-06-17 08:47:48 UTC
The problem seems to have been resolved, probably by Alex's fix to run streams in a stopped context:

http://ghostscript.com/pipermail/gs-cvs/2011-June/012998.html

I'm not certain if Alex's patch in comment #3 still needs to be committed, so I'm assigning to Alex to review this. Please just close the bug if its not required.
Comment 8 Alex Cherepanov 2011-06-28 01:29:16 UTC
The oath #3 has been committed as a rev. 0f592834 on 2011-05-10 00:21:21.