[FFmpeg-cvslog] swscale: fix underflows in firstline calculations for extreme resizes.

Ronald S. Bultje git at videolan.org
Fri Feb 24 04:34:59 CET 2012


ffmpeg | branch: master | Ronald S. Bultje <rsbultje at gmail.com> | Wed Feb 22 16:47:14 2012 -0800| [491865b57db5fbb3053c221fd6d94b0435cad105] | committer: Ronald S. Bultje

swscale: fix underflows in firstline calculations for extreme resizes.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable at libav.org

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=491865b57db5fbb3053c221fd6d94b0435cad105
---

 libswscale/swscale.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index b231302..bd909bf 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -407,9 +407,9 @@ static int swScale(SwsContext *c, const uint8_t* src[],
             (CONFIG_SWSCALE_ALPHA && alpPixBuf) ? dst[3] + dstStride[3] * dstY : NULL,
         };
 
-        const int firstLumSrcY= vLumFilterPos[dstY]; //First line needed as input
-        const int firstLumSrcY2= vLumFilterPos[FFMIN(dstY | ((1<<c->chrDstVSubSample) - 1), dstH-1)];
-        const int firstChrSrcY= vChrFilterPos[chrDstY]; //First line needed as input
+        const int firstLumSrcY= FFMAX(1 - vLumFilterSize, vLumFilterPos[dstY]); //First line needed as input
+        const int firstLumSrcY2= FFMAX(1 - vLumFilterSize, vLumFilterPos[FFMIN(dstY | ((1<<c->chrDstVSubSample) - 1), dstH-1)]);
+        const int firstChrSrcY= FFMAX(1 - vChrFilterSize, vChrFilterPos[chrDstY]); //First line needed as input
 
         // Last line needed as input
         int lastLumSrcY  = FFMIN(c->srcH,    firstLumSrcY  + vLumFilterSize) - 1;



More information about the ffmpeg-cvslog mailing list