[poppler] Branch 'poppler-0.6' - poppler/SplashOutputDev.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Thu Dec 13 14:23:28 PST 2007


 poppler/SplashOutputDev.cc |   23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

New commits:
commit 861a7a1f9ec08cb667b9b5ba7f231a11ae893960
Author: Albert Astals Cid <aacid at kde.org>
Date:   Thu Dec 13 23:22:35 2007 +0100

    Yet another gmallocn to gmallocn_checkoverflow
    
    Fixes http://bugs.kde.org/show_bug.cgi?id=153949

diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc
index b510648..cb5f5e6 100644
--- a/poppler/SplashOutputDev.cc
+++ b/poppler/SplashOutputDev.cc
@@ -500,11 +500,18 @@ T3FontCache::T3FontCache(Ref *fontIDA, double m11A, double m12A,
   } else {
     cacheSets = 1;
   }
-  cacheData = (Guchar *)gmallocn(cacheSets * cacheAssoc, glyphSize);
-  cacheTags = (T3FontCacheTag *)gmallocn(cacheSets * cacheAssoc,
+  cacheData = (Guchar *)gmallocn_checkoverflow(cacheSets * cacheAssoc, glyphSize);
+  if (cacheData != NULL)
+  {
+    cacheTags = (T3FontCacheTag *)gmallocn(cacheSets * cacheAssoc,
 					 sizeof(T3FontCacheTag));
-  for (i = 0; i < cacheSets * cacheAssoc; ++i) {
-    cacheTags[i].mru = i & (cacheAssoc - 1);
+    for (i = 0; i < cacheSets * cacheAssoc; ++i) {
+      cacheTags[i].mru = i & (cacheAssoc - 1);
+    }
+  }
+  else
+  {
+    cacheTags = NULL;
   }
 }
 
@@ -1421,11 +1428,13 @@ GBool SplashOutputDev::beginType3Char(GfxState *state, double x, double y,
   // is the glyph in the cache?
   i = (code & (t3Font->cacheSets - 1)) * t3Font->cacheAssoc;
   for (j = 0; j < t3Font->cacheAssoc; ++j) {
-    if ((t3Font->cacheTags[i+j].mru & 0x8000) &&
+    if (t3Font->cacheTags != NULL) {
+      if ((t3Font->cacheTags[i+j].mru & 0x8000) &&
 	t3Font->cacheTags[i+j].code == code) {
-      drawType3Glyph(t3Font, &t3Font->cacheTags[i+j],
+        drawType3Glyph(t3Font, &t3Font->cacheTags[i+j],
 		     t3Font->cacheData + (i+j) * t3Font->glyphSize);
-      return gTrue;
+        return gTrue;
+      }
     }
   }
 


More information about the poppler mailing list