Fix for bug 688013, bad PDF file from Enfocus PitStop 3.1 fais

Alex Cherepanov <[email protected]> Thu, 31 Mar 2005 12:33:57 -0500
Newsgroups gmane.comp.printing.ghostscript.patches
Organization Coscript Software
Message-ID <[email protected]>
Work around a bug in PDF files produced by Enfocus PitStop 3.1. Handle
annotation border object depending on the actual type of the object, not
the key name.
Fix bug 688013

_______________________________________________
gs-code-review mailing list
[email protected]
http://www.ghostscript.com/mailman/listinfo/gs-code-review
688013.diff (text/plain, 1.1 KB)
Index: gs/lib/pdf_draw.ps
===================================================================
RCS file: /cvs/ghostscript/gs/lib/pdf_draw.ps,v
retrieving revision 1.91
diff -b -u -r1.91 pdf_draw.ps
--- gs/lib/pdf_draw.ps	14 Mar 2005 18:08:39 -0000	1.91
+++ gs/lib/pdf_draw.ps	31 Mar 2005 16:57:52 -0000
@@ -1157,20 +1157,30 @@
 % Draw an annotation border.
 /drawborder {		% <annot> drawborder -
   gsave
+  dup /BS known 1 index /Border known or {
   dup /BS knownoget {
+      dup type /dicttype ne   % <annot> <border> <bad?>
+    } {
+      dup /Border oget 
+      dup type /arraytype ne  % <annot> [border] <bad?>
+    } ifelse
+    { 
+      (   **** Warning: Wrong type of annotation border object.\n)
+      pdfformaterror
+    } if
+    dup type /dicttype eq {
     dup /W knownoget not { 1 } if
     [] 2 index /S knownoget {
       /D eq { 2 index /D knownoget not { [3] } if exch pop } if
     } if 3 -1 roll pop strokeborder
   } {
-    dup /Border knownoget {
       dup 2 get
       exch dup length 3 gt { 3 get } { pop [] } ifelse
       strokeborder
+    } ifelse
     } {
       1 [] strokeborder
     } ifelse
-  } ifelse
   grestore
 } bdef