[gs-cvs] rev 7032 - trunk/gs/src
lpd at ghostscript.com
lpd at ghostscript.com
Sun Sep 10 20:32:52 PDT 2006
Author: lpd
Date: 2006-09-10 20:32:51 -0700 (Sun, 10 Sep 2006)
New Revision: 7032
Modified:
trunk/gs/src/zfont0.c
Log:
Makes zbuildfont0 generate a rangecheck error if the Encoding of a
SubsVector-based font is not large enough for the entire code space, for
greater Adobe compatibility. (The graphics library only causes an error if
a show operator would actually reference an element beyond the end of the
Encoding.)
Modified: trunk/gs/src/zfont0.c
===================================================================
--- trunk/gs/src/zfont0.c 2006-09-11 03:29:39 UTC (rev 7031)
+++ trunk/gs/src/zfont0.c 2006-09-11 03:32:51 UTC (rev 7032)
@@ -189,6 +189,20 @@
/* Fill in the font data */
pdata = pfont_data(pfont);
data.encoding_size = r_size(&pdata->Encoding);
+ /*
+ * Adobe interpreters apparently require that Encoding.size >= subs_size
+ * +1 (not sure whether the +1 only applies if the sum of the range
+ * sizes is less than the size of the code space). The gs library
+ * doesn't require this -- it only gives an error if a show operation
+ * actually would reference beyond the end of the Encoding -- so we
+ * check this here rather than in the library.
+ */
+ if (data.FMapType == fmap_SubsVector) {
+ if (data.subs_size >= r_size(&pdata->Encoding)) {
+ code = gs_note_error(e_rangecheck);
+ goto fail;
+ }
+ }
data.Encoding =
(uint *) ialloc_byte_array(data.encoding_size, sizeof(uint),
"buildfont0(Encoding)");
@@ -234,7 +248,10 @@
if (code >= 0)
return code;
fail:
- /* Undo the insertion of the FID entry in the dictionary. */
+ /*
+ * Undo the insertion of the FID entry in the dictionary. Note that
+ * some allocations (Encoding, FDepVector) are not undone.
+ */
if (r_has_type(&save_FID, t_null)) {
ref rnfid;
More information about the gs-cvs
mailing list