poppler/SplashOutputDev.cc | 4 ++-- splash/Splash.cc | 38 ++++++++++++++++++++------------------ 2 files changed, 22 insertions(+), 20 deletions(-)
New commits: commit 2a09ec47aef8870dba345f4045e691ffb5a59f4d Author: Albert Astals Cid <[email protected]> Date: Mon Oct 24 20:04:22 2016 +0200 Fix memory leak in parametrized gouraudTriangleShadedFill diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc index 688540b..d454e0e 100644 --- a/poppler/SplashOutputDev.cc +++ b/poppler/SplashOutputDev.cc @@ -4762,17 +4762,17 @@ GBool SplashOutputDev::gouraudTriangleShadedFill(GfxState *state, GfxGouraudTria default: break; } - SplashGouraudColor *splashShading = new SplashGouraudPattern(bDirectColorTranslation, state, shading, colorMode); // restore vector antialias because we support it here if (shading->isParameterized()) { + SplashGouraudColor *splashShading = new SplashGouraudPattern(bDirectColorTranslation, state, shading, colorMode); GBool vaa = getVectorAntialias(); GBool retVal = gFalse; setVectorAntialias(gTrue); retVal = splash->gouraudTriangleShadedFill(splashShading); setVectorAntialias(vaa); + delete splashShading; return retVal; } - delete splashShading; return gFalse; } commit 169889b8e196cfcd288e6555fb048fbbf95ba3f6 Author: Albert Astals Cid <[email protected]> Date: Mon Oct 24 20:04:00 2016 +0200 Fix crash on broken files diff --git a/splash/Splash.cc b/splash/Splash.cc index e179c1c..46b8ce2 100644 --- a/splash/Splash.cc +++ b/splash/Splash.cc @@ -5745,24 +5745,26 @@ GBool Splash::gouraudTriangleShadedFill(SplashGouraudColor *shading) colorinterp = scanColorMap[0] * scanLimitL + scanColorMap[1]; bitmapOff = scanLineOff + scanLimitL * colorComps; - for (int X = scanLimitL; X <= scanLimitR && bitmapOff + colorComps <= bitmapOffLimit; ++X, colorinterp += scanColorMap[0], bitmapOff += colorComps) { - // FIXME : standard rectangular clipping can be done for a - // complete scanline which is faster - // --> see SplashClip and its methods - if (!clip->test(X, Y)) - continue; - - assert(fabs(colorinterp - (scanColorMap[0] * X + scanColorMap[1])) < 1e-10); - assert(bitmapOff == Y * rowSize + colorComps * X && scanLineOff == Y * rowSize); - - shading->getParameterizedColor(colorinterp, bitmapMode, &bitmapData[bitmapOff]); - - // make the shading visible. - // Note that opacity is handled by the bDirectBlit stuff, see - // above for comments and below for implementation. - if (hasAlpha) - bitmapAlpha[Y * bitmapWidth + X] = 255; - } + if (likely(bitmapOff >= 0)) { + for (int X = scanLimitL; X <= scanLimitR && bitmapOff + colorComps <= bitmapOffLimit; ++X, colorinterp += scanColorMap[0], bitmapOff += colorComps) { + // FIXME : standard rectangular clipping can be done for a + // complete scanline which is faster + // --> see SplashClip and its methods + if (!clip->test(X, Y)) + continue; + + assert(fabs(colorinterp - (scanColorMap[0] * X + scanColorMap[1])) < 1e-10); + assert(bitmapOff == Y * rowSize + colorComps * X && scanLineOff == Y * rowSize); + + shading->getParameterizedColor(colorinterp, bitmapMode, &bitmapData[bitmapOff]); + + // make the shading visible. + // Note that opacity is handled by the bDirectBlit stuff, see + // above for comments and below for implementation. + if (hasAlpha) + bitmapAlpha[Y * bitmapWidth + X] = 255; + } + } } } } else { _______________________________________________ poppler mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/poppler
