[gs-cvs] rev 7081 - in trunk/gs: src toolbin

alexcher at ghostscript.com alexcher at ghostscript.com
Wed Oct 4 05:30:21 PDT 2006


Author: alexcher
Date: 2006-10-04 05:30:21 -0700 (Wed, 04 Oct 2006)
New Revision: 7081

Modified:
   trunk/gs/src/gdevpdtb.c
   trunk/gs/toolbin/vg_bugs.supp
Log:
Fix off-by-one error in the PDF font subset prefix generator that
mixed in an uninitialised byte when the object size was odd.
This error caused indeterministic PDF generation and Valgrind warnings.
Bug 688911.

DIFFERENCES:
None


Modified: trunk/gs/src/gdevpdtb.c
===================================================================
--- trunk/gs/src/gdevpdtb.c	2006-10-04 11:09:21 UTC (rev 7080)
+++ trunk/gs/src/gdevpdtb.c	2006-10-04 12:30:21 UTC (rev 7081)
@@ -62,7 +62,7 @@
     return true;
 }
 
-private ulong
+private inline ulong
 hash(ulong v, int index, ushort w)
 {
     return v * 3141592653u + w;
@@ -79,20 +79,19 @@
 				  size + SUBSET_PREFIX_SIZE,
 				  "pdf_add_subset_prefix");
     int len = (count + 7) / 8;
+    int len0 = len & ~(sizeof(ushort) - 1);
     ulong v = 0;
     int i;
 
     if (data == 0)
 	return_error(gs_error_VMerror);
+    
     /* Hash the 'used' array. */
-    for (i = 0; i < len; i += sizeof(ushort))
+    for (i = 0; i < len0; i += sizeof(ushort))
 	v = hash(v, i, *(ushort *)(used + i));
-    if (i > len) {
-        ushort t = 0;
-	i -= sizeof(ushort);
-	memmove(&t, used + i, len - i);
-	v = hash(v, i, t);
-    }
+    for (; i < len; i++)
+        v = hash(v, i, used[i]);
+
     memmove(data + SUBSET_PREFIX_SIZE, data, size);
     for (i = 0; i < SUBSET_PREFIX_SIZE - 1; ++i, v /= 26)
 	data[i] = 'A' + (v % 26);

Modified: trunk/gs/toolbin/vg_bugs.supp
===================================================================
--- trunk/gs/toolbin/vg_bugs.supp	2006-10-04 11:09:21 UTC (rev 7080)
+++ trunk/gs/toolbin/vg_bugs.supp	2006-10-04 12:30:21 UTC (rev 7081)
@@ -113,16 +113,6 @@
    fun:gs_image_next_planes
 }
 
-# Put name
-# pdfwrite - Bug687698.ps
-{
-   <bug 688911>
-   Memcheck:Cond
-   fun:pdf_put_name_chars_1_2
-   fun:pdf_put_name_chars
-   fun:pdf_put_name
-}
-
 # Image 3
 # pdfwrite - ai2.pdf
 {



More information about the gs-cvs mailing list