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

Albert Astals Cid aacid at kemper.freedesktop.org
Thu Jan 31 14:52:52 PST 2008


 poppler/SplashOutputDev.cc |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit 3770d3922242b101fe8cfade67ee97b08e3a3ac8
Author: Albert Astals Cid <aacid at kde.org>
Date:   Thu Jan 31 23:52:20 2008 +0100

    Ensure we don't draw outside the main bitmap on SplashOutputDev::setSoftMask
    
    Fixes crash on http://bugs.kde.org/show_bug.cgi?id=157000

diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc
index cb5f5e6..8c6affb 100644
--- a/poppler/SplashOutputDev.cc
+++ b/poppler/SplashOutputDev.cc
@@ -2619,8 +2619,12 @@ void SplashOutputDev::setSoftMask(GfxState * /*state*/, double * /*bbox*/,
   memset(softMask->getDataPtr(), 0,
 	 softMask->getRowSize() * softMask->getHeight());
   p = softMask->getDataPtr() + ty * softMask->getRowSize() + tx;
-  for (y = 0; y < tBitmap->getHeight(); ++y) {
-    for (x = 0; x < tBitmap->getWidth(); ++x) {
+  int xMax = tBitmap->getWidth();
+  int yMax = tBitmap->getHeight();
+  if (xMax + tx > bitmap->getWidth()) xMax = bitmap->getWidth() - tx;
+  if (yMax + ty > bitmap->getHeight()) yMax = bitmap->getHeight() - ty;
+  for (y = 0; y < yMax; ++y) {
+    for (x = 0; x < xMax; ++x) {
       tBitmap->getPixel(x, y, color);
       if (alpha) {
 	//~ unimplemented


More information about the poppler mailing list