[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/KDE/3.5/kdegraphics/kpdf/xpdf/xpdf
From:       Albert Astals Cid <tsdgeos () terra ! es>
Date:       2007-12-13 22:19:55
Message-ID: 1197584395.350398.14601.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 748237 by aacid:

Yet another gmallocn to gmallocn_checkoverflow, fixes ugly exit produced by page 61 \
                of http://nlp.stanford.edu/IR-book/pdf/irbookonlinereading.pdf
BUGS: 153949


 M  +16 -7     SplashOutputDev.cc  


--- branches/KDE/3.5/kdegraphics/kpdf/xpdf/xpdf/SplashOutputDev.cc #748236:748237
@@ -525,12 +525,19 @@
   } 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;
+  }
 }
 
 T3FontCache::~T3FontCache() {
@@ -1522,11 +1529,13 @@
   // 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;
+      }
     }
   }
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic