swscale: fix filtersize clipping.
authorRonald S. Bultje <rsbultje@gmail.com>
Wed, 22 Feb 2012 22:51:37 +0000 (14:51 -0800)
committerRonald S. Bultje <rsbultje@gmail.com>
Thu, 23 Feb 2012 00:54:20 +0000 (16:54 -0800)
if srcW<=2, clip(x, 1, srcW-2) still allows srcW to be < 1.

libswscale/utils.c

index 2fe9c5b..6ae8af6 100644 (file)
@@ -263,7 +263,8 @@ static int initFilter(int16_t **outFilter, int16_t **filterPos, int *outFilterSi
         if (xInc <= 1<<16)      filterSize= 1 + sizeFactor; // upscale
         else                    filterSize= 1 + (sizeFactor*srcW + dstW - 1)/ dstW;
 
-        filterSize = av_clip(filterSize, 1, srcW - 2);
+        filterSize = FFMIN(filterSize, srcW - 2);
+        filterSize = FFMAX(filterSize, 1);
 
         FF_ALLOC_OR_GOTO(NULL, filter, dstW*sizeof(*filter)*filterSize, fail);