[gs-commits] ghostpdl branch, master, updated. jbig2dec-0.14-1721-g9dddc61

[email protected] (Ken Sharp) Thu, 10 Oct 2019 16:13:22 +0000 (UTC)
Newsgroups gmane.comp.printing.ghostscript.cvs
Message-ID <[email protected]>
The ghostpdl branch, master has been updated
       via  9dddc61852d012b867e0353c7897b9c5301e17e6 (commit)
      from  d305e46c4af1af14dfe79f7ebab6d2edf168f068 (commit)

----------------------------------------------------------------------
commit 9dddc61852d012b867e0353c7897b9c5301e17e6
Author: Ken Sharp <[email protected]>
Date:   Thu Oct 10 17:13:16 2019 +0100

    PDF interpreter - Ignore invalid MediaBox array
    
    Again, no bug, the specimen file is a confidential customer file.
    
    The file contains, on page 60, an invalid MediaBox:
    
    /MediaBox[ 0 0 612 792 0 0 720 917]
    
    The 8 values were unloaded onto the stack, but only 4 were consumed
    leading to errors later in processing. This commit checks the length
    of the array and if it isn't exactly 4 then it exits and uses the
    current page size instead.

diff --git a/Resource/Init/pdf_main.ps b/Resource/Init/pdf_main.ps
index 7690bae..84f90b0 100644
--- a/Resource/Init/pdf_main.ps
+++ b/Resource/Init/pdf_main.ps
@@ -2339,8 +2339,20 @@ end readonly def
 
 /get_media_box { % <pagedict> get_media_box <box> <bool>
   /MediaBox pget {
-    oforce_array //true
-  } {
+    oforce_array
+    dup length 4 eq {
+      //true
+    }
+    {
+      pop
+      (   **** Error: Page has an invalid /MediaBox attribute. Using the current page size.\n)
+      pdfformaterror
+      (               Output may be incorrect.\n) pdfformaterror
+      [ 0 0 currentpagedevice /PageSize get aload pop ]
+      //false
+    }ifelse
+  }
+  {
     (   **** Error: Page has no /MediaBox attribute. Using the current page size.\n)
     pdfformaterror
     (               Output may be incorrect.\n) pdfformaterror


Summary of changes:
 Resource/Init/pdf_main.ps | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)