From kde-commits Sat Apr 30 14:34:54 2005 From: Albert Astals Cid Date: Sat, 30 Apr 2005 14:34:54 +0000 To: kde-commits Subject: kdegraphics/kpdf/xpdf/fofi Message-Id: <20050430143454.3BE35665 () office ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=111487171107789 CVS commit by aacid: Don't assume Encoding array of Type1 fonts end in "foo def". http://partners.adobe.com/public/developer/en/font/T1_SPEC.PDF says "This sequence of assignments must be followed by an instance of the token def or readonly; such a token may not occur within the sequence of assignments." so it must end with "readonly" "def" "readonly def" (That is what most fonts are using and this is why it was not crashing" BUG: 104786 M +8 -3 FoFiType1.cc 1.2 --- kdegraphics/kpdf/xpdf/fofi/FoFiType1.cc #1.1:1.2 @@ -188,7 +188,12 @@ void FoFiType1::parse() { } } else { - if (strtok(buf, " \t") && - (p = strtok(NULL, " \t\n\r")) && !strcmp(p, "def")) { - break; + p = strtok(buf, " \t\n\r"); + if (p) + { + if (!strcmp(p, "def")) break; + if (!strcmp(p, "readonly")) break; + // the spec does not says this but i'm mantaining old xpdf behaviour that accepts "foo def" as end of the encoding array + p = strtok(buf, " \t\n\r"); + if (p && !strcmp(p, "def")) break; } }