diff --git a/fofi/FoFiTrueType.cc b/fofi/FoFiTrueType.cc index cd11d6f..3ae2631 100644 --- a/fofi/FoFiTrueType.cc +++ b/fofi/FoFiTrueType.cc @@ -1421,7 +1421,7 @@ void FoFiTrueType::parse() { void FoFiTrueType::readPostTable() { GooString *name; - int tablePos, postFmt, stringIdx, stringPos; + int tablePos, postFmt, stringIdx, stringPos, savedStringIdx; GBool ok; int i, j, n, m; @@ -1456,6 +1456,7 @@ void FoFiTrueType::readPostTable() { nameToGID->removeInt(macGlyphNames[j]); nameToGID->add(new GooString(macGlyphNames[j]), i); } else { + savedStringIdx = stringIdx; j -= 258; if (j != stringIdx) { for (stringIdx = 0, stringPos = tablePos + 34 + 2*n; @@ -1467,13 +1468,17 @@ void FoFiTrueType::readPostTable() { } m = getU8(stringPos, &ok); if (!ok || !checkRegion(stringPos + 1, m)) { - goto err; - } - name = new GooString((char *)&file[stringPos + 1], m); - nameToGID->removeInt(name); - nameToGID->add(name, i); - ++stringIdx; - stringPos += 1 + m; + stringIdx = savedStringIdx; + ok = gTrue; + nameToGID->removeInt(macGlyphNames[j]); + nameToGID->add(new GooString(macGlyphNames[0]), i); + } else { + name = new GooString((char *)&file[stringPos + 1], m); + nameToGID->removeInt(name); + nameToGID->add(name, i); + ++stringIdx; + stringPos += 1 + m; + } } } } else if (postFmt == 0x00028000) {