[poppler] fofi/FoFiTrueType.cc

Carlos Garcia Campos carlosgc at kemper.freedesktop.org
Mon Oct 22 02:26:40 PDT 2007


 fofi/FoFiTrueType.cc |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

New commits:
commit dbe975c129999a3efceb1c86518fa6fda74f685c
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date:   Mon Oct 22 11:25:37 2007 +0200

    Fix a crash with invalid TrueType fonts

diff --git a/fofi/FoFiTrueType.cc b/fofi/FoFiTrueType.cc
index abfca73..77a7ad2 100644
--- a/fofi/FoFiTrueType.cc
+++ b/fofi/FoFiTrueType.cc
@@ -912,10 +912,12 @@ void FoFiTrueType::writeTTF(FoFiOutputFunc outputFunc,
   badCmapLen = gFalse;
   cmapLen = 0; // make gcc happy
   if (!missingCmap) {
-    cmapLen = cmaps[0].offset + cmaps[0].len;
-    for (i = 1; i < nCmaps; ++i) {
-      if (cmaps[i].offset + cmaps[i].len > cmapLen) {
-	cmapLen = cmaps[i].offset + cmaps[i].len;
+    if (nCmaps > 0) {
+      cmapLen = cmaps[0].offset + cmaps[0].len;
+      for (i = 1; i < nCmaps; ++i) {
+        if (cmaps[i].offset + cmaps[i].len > cmapLen) {
+	  cmapLen = cmaps[i].offset + cmaps[i].len;
+        }
       }
     }
     cmapLen -= tables[cmapIdx].offset;


More information about the poppler mailing list