[gs-commits] rev 10851 - trunk/ghostpdl/tools

hintak at ghostscript.com hintak at ghostscript.com
Thu Mar 4 19:38:33 UTC 2010


Author: hintak
Date: 2010-03-04 19:38:32 +0000 (Thu, 04 Mar 2010)
New Revision: 10851

Modified:
   trunk/ghostpdl/tools/pxldis.py
Log:
First part of fixing 691146: script should abort with suitable informative message
when encountering unknown tags instead of silently emitting wrong result.


Modified: trunk/ghostpdl/tools/pxldis.py
===================================================================
--- trunk/ghostpdl/tools/pxldis.py	2010-03-03 21:47:53 UTC (rev 10850)
+++ trunk/ghostpdl/tools/pxldis.py	2010-03-04 19:38:32 UTC (rev 10851)
@@ -716,8 +716,10 @@
             self.index = self.index + 1
 
             tag = unpack('B', self.data[self.index] )[0]
+            tag_not_listed = 1
             for k in pxl_attribute_name_to_attribute_number_dict.keys():
                 if ( pxl_attribute_name_to_attribute_number_dict[k] == tag ):
+                    tag_not_listed = 0
                     print k,
                     if pxl_enumerations_dict.has_key(k):
                         print "//",
@@ -734,6 +736,9 @@
 		    if ( self.isEmbedded(k) ):
 			self.process_EmbeddedInfo(k)
                     return 1
+            if (tag_not_listed):
+                print >> sys.stderr, "Unlisted attribute number:", tag
+                raise(SyntaxError), "Unlisted attribute number in PXL stream"
         return 0
 
     def Tag_attr_uint16(self):



More information about the gs-commits mailing list