[gs-cvs] rev 8451 - trunk/gs/src
alexcher at ghostscript.com
alexcher at ghostscript.com
Tue Dec 18 22:22:23 PST 2007
Author: alexcher
Date: 2007-12-18 22:22:22 -0800 (Tue, 18 Dec 2007)
New Revision: 8451
Modified:
trunk/gs/src/sfilter1.c
Log:
Treat the text after empty ASCII block in PFB stream as ASCII sub-stream
terminated by 0x80 character, a presumed header of the next block.
Bug 689617, customer 580.
DIFFERENCES:
None.
Modified: trunk/gs/src/sfilter1.c
===================================================================
--- trunk/gs/src/sfilter1.c 2007-12-19 00:25:08 UTC (rev 8450)
+++ trunk/gs/src/sfilter1.c 2007-12-19 06:22:22 UTC (rev 8451)
@@ -73,6 +73,21 @@
ss->record_left = p[3] + ((uint) p[4] << 8) +
((ulong) p[5] << 16) +
((ulong) p[6] << 24);
+
+ /* Check for an invalid counter found in an Adobe font, bug 689617 */
+ if (ss->record_left == 0 && ss->record_type == 1) {
+ if (p + 7 < pr->limit) {
+ if (p[6] == 128)
+ ; /* normal empty block */
+ else {
+ ss->record_type = 4; /* ASCII stuff between blocks */
+ ss->record_left = ~0;
+ }
+ } else {
+ if (!last)
+ goto out;
+ }
+ }
p += 6;
goto top;
case 1: /* text data */
@@ -120,6 +135,22 @@
q += count;
}
break;
+ case 4:
+ /* Treat the text after empty ASCII block as ACSII stream */
+ /* Translate \r to \n. */
+ {
+ int count = (wcount < rcount ? (status = 1, wcount) : rcount);
+ for (; count != 0; count--) {
+ c = *++p;
+ if (c == 128)
+ { --p;
+ ss->record_left = 0;
+ break;
+ }
+ *++q = (c == '\r' ? '\n' : c);
+ }
+ }
+ break;
}
if (ss->record_left == 0) {
ss->record_type = -1;
More information about the gs-cvs
mailing list