SVN commit 769259 by aacid: Ensure we don't draw outside the main bitmap on SplashOutputDev::setSoftMask BUG: 157000 M +6 -2 SplashOutputDev.cc --- branches/KDE/3.5/kdegraphics/kpdf/xpdf/xpdf/SplashOutputDev.cc #769258:769259 @@ -2650,8 +2650,12 @@ 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