aboutsummaryrefslogtreecommitdiffstats
path: root/libswscale/swscale.c
diff options
context:
space:
mode:
authorRonald S. Bultje <rsbultje@gmail.com>2012-02-22 16:47:14 -0800
committerRonald S. Bultje <rsbultje@gmail.com>2012-02-23 10:30:07 -0800
commit491865b57db5fbb3053c221fd6d94b0435cad105 (patch)
tree3b088dce41163f35e1ee54e3bf4268731346de64 /libswscale/swscale.c
parent19a65b5be47944c607a9e979edb098924d95f2e4 (diff)
downloadffmpeg-491865b57db5fbb3053c221fd6d94b0435cad105.tar.gz
swscale: fix underflows in firstline calculations for extreme resizes.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC: libav-stable@libav.org
Diffstat (limited to 'libswscale/swscale.c')
-rw-r--r--libswscale/swscale.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index b231302216..bd909bf163 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;