Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
For bugs related to Red Hat Enterprise Linux 5 product line. The current stable release is 5.10. For Red Hat Enterprise Linux 6 and above, please visit Red Hat JIRA https://issues.redhat.com/secure/CreateIssue!default.jspa?pid=12332745 to report new issues.

Bug 545821

Summary: XREF table error and /undefined in /BXlevel erro when converting PDF 1.5 to PNG image
Product: Red Hat Enterprise Linux 5 Reporter: Olivier Fourdan <ofourdan>
Component: ghostscriptAssignee: Tim Waugh <twaugh>
Status: CLOSED ERRATA QA Contact: QE Internationalization Bugs <qe-i18n-bugs>
Severity: high Docs Contact:
Priority: high    
Version: 5.4CC: cward, jtmoree, kem, ktakemur, pasteur, pknirsch, vbenes
Target Milestone: rcKeywords: Patch
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: ghostscript-8.70-1.el5 Doc Type: Bug Fix
Doc Text:
When converting a PDF 1.5 document to PNG, running the gs command resulted in the following error message: ERROR: /undefined in /BXlevel This has been fixed, and the conversion from PDF 1.5 to PNG no longer fails with the above error.
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-01-13 22:06:45 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Proposed patch none

Description Olivier Fourdan 2009-12-09 12:46:22 UTC
Description of problem:

Converting pdf-1.5 document to a png image causes an "/undefined in /BXlevel" in ghostscript-8.15

Version-Release number of selected component (if applicable):

ghostscript-8.15.2-9.11

How reproducible:

Always with given test pdf file

Steps to Reproduce:
1. Save PDF file to test.pdf
2. Run:

   $ gs -dSAFER -dNOPAUSE -dBATCH -dFirstPage=1 -dLastPage=30 -sDEVICE=png16m -sOutputFile=test.png  test.pdf
  
Actual results:

ESP Ghostscript 815.02 (2006-04-19)
Copyright (C) 2004 artofcode LLC, Benicia, CA.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
   **** 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.
ERROR: /undefined in /BXlevel
Operand stack:
   1   --dict:6/6(ro)(G)--
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1   3   %oparray_pop   1   3   %oparray_pop   1   3   %oparray_pop   --nostringval--   --nostringval--   --nostringval--   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   --nostringval--   %loop_continue   --nostringval--
Dictionary stack:
   --dict:1121/1686(ro)(G)--   --dict:0/20(G)--   --dict:107/200(L)--   --dict:107/200(L)--   --dict:104/127(ro)(G)--   --dict:241/347(ro)(G)--   --dict:18/24(L)--
Current allocation mode is local
ESP Ghostscript 815.02: Unrecoverable error, exit code 1


Expected results:

ESP Ghostscript 815.02 (2006-04-19)
Copyright (C) 2004 artofcode LLC, Benicia, CA.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 1.
Page 1
Loading NimbusRomNo9L-Regu font from /usr/share/fonts/default/Type1/n021003l.pfb... 3180904 1875258 2377112 757086 3 done.
Using NimbusRomanNo9L-Regu font for NimbusRomNo9L-Regu.
Loading NimbusRomNo9L-Medi font from /usr/share/fonts/default/Type1/n021004l.pfb... 3385384 2081240 2377112 763424 3 done.
Loading NimbusMonL-Regu font from /usr/share/fonts/default/Type1/n022003l.pfb... 3586184 2269637 2437664 816546 3 done.
Loading NimbusMonL-Bold font from /usr/share/fonts/default/Type1/n022004l.pfb... 3806496 2487118 2437664 821996 3 done.

Additional info:

The problem occurs only with PDF 1.5, works fine with 1.3. The same PDF is converted successfully with ghostscript 8.30.

Attaching patch including backport the following fixes:

 r4462:
 - This is the first pass at the changes to support the PDF 1.5 revisions
   to the PDF format.
 
 r6120:
 - Fix for double 'endstream' in a Content stream. Now endstream terminates
   the object the same way 'endobj' would. Bug 688303 for customer 670.
 
 r6920:
 - Fix for 688787 /undefined in /BXlevel.
 
 r7834:
 - Increase the size of %stdin buffer to support larger lookahead requests and
   look for for %PDF- tag in the first 1024 bytes of the file. Fix bug 687125,

 r8787:
 - Add work-around for PDF files that misspell 'endobj' as 'endjobj'. 
   Bug 689876.

 r9629:
 - Repair broken PDF files created by "OKI HotKey" that misspell "endobj"
   as "enbobj". Bug 690397.

Note that this issue is not the same as bug #517382 (the backtrace is different and the proposed patch does not address the issue in bug #517382)

Comment 1 Olivier Fourdan 2009-12-09 12:47:11 UTC
Created attachment 377168 [details]
Proposed patch

Comment 5 Jaromir Hradilek 2010-07-20 09:57:30 UTC
Technical note added. If any revisions are required, please edit the "Technical Notes" field
accordingly. All revisions will be proofread by the Engineering Content Services team.

New Contents:
When converting a PDF 1.5 document to PNG, running the gs command resulted in the following error message:

  ERROR: /undefined in /BXlevel

This has been fixed, and the conversion from PDF 1.5 to PNG no longer fails with the above error.

Comment 8 Tim Waugh 2010-08-31 10:37:55 UTC
*** Bug 524282 has been marked as a duplicate of this bug. ***

Comment 10 errata-xmlrpc 2011-01-13 22:06:45 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-0137.html