[gs-cvs] rev 8149 - trunk/gs/lib

alexcher at ghostscript.com alexcher at ghostscript.com
Sun Jul 29 09:11:45 PDT 2007


Author: alexcher
Date: 2007-07-29 09:11:45 -0700 (Sun, 29 Jul 2007)
New Revision: 8149

Modified:
   trunk/gs/lib/pdf_main.ps
Log:
Ignore named actions in PDF link annotations that refer to a page outside
of the document page range. Bug 689286.

DIFFERENCES:
None


Modified: trunk/gs/lib/pdf_main.ps
===================================================================
--- trunk/gs/lib/pdf_main.ps	2007-07-28 16:13:12 UTC (rev 8148)
+++ trunk/gs/lib/pdf_main.ps	2007-07-29 16:11:45 UTC (rev 8149)
@@ -1077,20 +1077,12 @@
     }
    if
 } bind def
-% <pagedict> mark ... -proc- -
+% <pagedict> mark ... -proc- <page#> <error>
 /namedactions 8 dict dup begin
-  /FirstPage {
-    /Page 1 3 -1 roll
-  } def
-  /LastPage {
-    /Page pdfpagecount 3 -1 roll
-  } def
-  /NextPage {
-    counttomark 2 add index pdfpagenumber 1 add /Page exch 3 -1 roll
-  } def
-  /PrevPage {
-    counttomark 2 add index pdfpagenumber 1 sub /Page exch 3 -1 roll
-  } def
+  /FirstPage { 1 //false } def
+  /LastPage { pdfpagecount //false } def
+  /NextPage { counttomark 2 add index pdfpagenumber 1 add dup pdfpagecount gt } bind def
+  /PrevPage { counttomark 2 add index pdfpagenumber 1 sub dup 1 lt } bind def
 end readonly def
 % <pagedict> <annotdict> -proc- -
 /annottypes 5 dict dup begin
@@ -1116,7 +1108,15 @@
 	  exch pop exch dup length dict copy dup /Dest 4 -1 roll put
         } {
 	  /N knownoget {		% Assume /S /Named
-	     namedactions exch .knownget { exec } if
+	     namedactions exch .knownget {
+               exec {
+                 pop
+                 (   **** Warning: Ignoring a named action pointing out of the document page range.\n)
+                 pdfformaterror
+               } {
+                 /Page exch 3 -1 roll
+               } ifelse
+             } if
 	  } if
         } ifelse
       } ifelse



More information about the gs-cvs mailing list