[gs-cvs] rev 7236 - trunk/gs/src
lpd at ghostscript.com
lpd at ghostscript.com
Thu Nov 30 13:01:19 PST 2006
Author: lpd
Date: 2006-11-30 13:01:19 -0800 (Thu, 30 Nov 2006)
New Revision: 7236
Modified:
trunk/gs/src/iscanbin.c
Log:
Fixes a bug that could cause a SEGV when reading binary token arrays on
systems where sizeof(ref) > 8 (e.g. 64-bit systems).
Modified: trunk/gs/src/iscanbin.c
===================================================================
--- trunk/gs/src/iscanbin.c 2006-11-30 20:41:53 UTC (rev 7235)
+++ trunk/gs/src/iscanbin.c 2006-11-30 21:01:19 UTC (rev 7236)
@@ -196,10 +196,15 @@
}
if (size < hsize)
return_error(e_syntaxerror);
- /* Preallocate an array large enough for the worst case, */
- /* namely, all objects and no strings. */
+ /*
+ * Preallocate an array large enough for the worst case,
+ * namely, all objects and no strings. Note that we must
+ * divide size by 8, not sizeof(ref), since array elements
+ * in binary tokens always occupy 8 bytes regardless of the
+ * size of a ref.
+ */
code = ialloc_ref_array(&pbs->bin_array,
- a_all + a_executable, size / sizeof(ref),
+ a_all + a_executable, size / 8,
"binary object sequence(objects)");
if (code < 0)
return code;
More information about the gs-cvs
mailing list