[poppler] Branch 'xpdf303merge' - fofi/FoFiTrueType.cc

Carlos Garcia Campos carlosgc at kemper.freedesktop.org
Tue Aug 30 07:33:39 PDT 2011


 fofi/FoFiTrueType.cc |    4 ++++
 1 file changed, 4 insertions(+)

New commits:
commit 73efc96eef6bd32a7c058b7dda8101f4f23c454f
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date:   Tue Aug 30 16:31:52 2011 +0200

    xpdf303: Handle bogus loca table entries in FoFiTrueType
    
    where the offset is past the end of the glyf table.

diff --git a/fofi/FoFiTrueType.cc b/fofi/FoFiTrueType.cc
index 79d2fe2..b76b7f1 100644
--- a/fofi/FoFiTrueType.cc
+++ b/fofi/FoFiTrueType.cc
@@ -1002,6 +1002,10 @@ void FoFiTrueType::writeTTF(FoFiOutputFunc outputFunc,
     }
     locaTable[nGlyphs].len = 0;
     std::sort(locaTable, locaTable + nGlyphs + 1, cmpTrueTypeLocaIdxFunctor());
+    // if the last entry in the loca is not the max offset (size of
+    // the glyf table), something is wrong -- work around the problem
+    // by forcing the last sorted entry to have a zero length
+    locaTable[nGlyphs].len = 0;
     pos = 0;
     for (i = 0; i <= nGlyphs; ++i) {
       locaTable[i].newOffset = pos;


More information about the poppler mailing list