Bug 691169

Summary: -dUseCropBox stack underflow, unrecoverable error with no CropBox defined in input PDF
Product: Ghostscript Reporter: Brent Bloxam <brent>
Component: PDF InterpreterAssignee: Alex Cherepanov <alex>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: P4    
Version: 8.70   
Hardware: PC   
OS: All   
Customer: Word Size: ---

Description Brent Bloxam 2010-03-10 20:45:07 UTC
Overview:

When no CropBox is defined in a PDF and -dUseCropBox is specified, Ghostscript experiences an unrecoverable error.

Steps to Reproduce:

gs -sDEVICE=tiffg3 -dUseCropBox -sOutputFile=out.tiff nocropbox.pdf

Actual Results:

GPL Ghostscript 8.70 (2009-07-31)
Copyright (C) 2009 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 1.
Page 1
   **** Page has no /MediaBox attribute. Using the current page size.
Error: /stackunderflow in --run--
Operand stack:
   --dict:11/11(L)--   612.0   792.0   3
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1830   1   3   %oparray_pop   1829   1   3   %oparray_pop   1813   1   3   %oparray_pop   --nostringval--   --nostringval--   2   1   1   --nostringval--   %for_pos_int_continue   --nostringval--   --nostringval--
Dictionary stack:
   --dict:1148/1684(ro)(G)--   --dict:1/20(G)--   --dict:75/200(L)--   --dict:75/200(L)--   --dict:106/127(ro)(G)--   --dict:285/300(ro)(G)--   --dict:21/25(L)--   --dict:2/6(L)--
Current allocation mode is local
GPL Ghostscript 8.70: Unrecoverable error, exit code 1

Expected Results:

Ghostscript should defer to using MediaBox if CropBox is not present. If this is not desired functionality for -dUseCropBox, another flag should be present to prefer CropBox, but defer to MediaBox in its absence (e.g., -dPreferCropBox)

Build Date & Platform:

GPL Ghostscript 8.70 (2009-07-31) on FreeBSD 7.0-RELEASE

Additional Information:

"Expected Result" functionality is desired for simpler automated conversion chain. Without the ability to default to MediaBox when no CropBox is present, extra steps must be taken to either identify PDFs with a CropBox or blindly defer to not using -dUseCropBox after first failure.
Comment 1 Alex Cherepanov 2010-03-10 23:24:57 UTC
Thank you for using and testing Ghostscript. This is a known bug v. 8.70.
It has been fixed shortly after the release. See bug 690676 for details.

V. 8.71 doesn't have this problem. Please upgrade.

*** This bug has been marked as a duplicate of bug 690676 ***