[poppler] splash/Splash.cc

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Aug 29 15:56:11 UTC 2020


 splash/Splash.cc |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 6a7dae795d3a08497db4a680d6d15ae10df0c681
Author: Tobias Deimigner <haxtibal at posteo.de>
Date:   Fri Aug 28 19:41:18 2020 +0200

    Splash bilinear scaling: Don't try read behind end
    
    Source line iteration in Splash::scaleImageYuXuBilinear already tries
    to prevent a read behind source image end, as the comment indicates it
    and as it's conceptually reasonable. But the check for (currentSrcRow < srcHeight)
    is wrong and doesn't do what it claims.
    
    currentSrcRow will only ever increase to srcHeight - 1 after
    scaledHeight iterations. Therefore the check always evaluates to
    true, and src() is aways called. Intention was to prevented the line
    fetch for the last run and leave line2 identical to line1 (the "extra padding").
    
    Nothing bad happened, because SplashOutputDev::imageSrc and alphaImageSrc
    gracefully handle the behind-end read. Should be corrected either.

diff --git a/splash/Splash.cc b/splash/Splash.cc
index 26586615..8f05dd54 100644
--- a/splash/Splash.cc
+++ b/splash/Splash.cc
@@ -4708,7 +4708,7 @@ void Splash::scaleImageYuXuBilinear(SplashImageSource src, void *srcData, Splash
             memcpy(lineBuf1, lineBuf2, scaledWidth * nComps);
             if (srcAlpha)
                 memcpy(alphaLineBuf1, alphaLineBuf2, scaledWidth);
-            if (currentSrcRow < srcHeight) {
+            if (currentSrcRow < srcHeight - 1) {
                 (*src)(srcData, srcBuf, alphaSrcBuf);
                 expandRow(srcBuf, lineBuf2, srcWidth, scaledWidth, nComps);
                 if (srcAlpha)


More information about the poppler mailing list