Commit 6a7dae79 authored by Tobias Deiminger's avatar Tobias Deiminger Committed by Albert Astals Cid

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.
parent 78e6050a
......@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment