[FFmpeg-cvslog] swscale: Fix an undefined behaviour

Luca Barbato git at videolan.org
Sun May 11 16:51:19 CEST 2014


ffmpeg | branch: release/2.2 | Luca Barbato <lu_zero at gentoo.org> | Fri May  2 00:21:23 2014 +0200| [a56a9e65c6a17dd8b6303dd45bdc3e3368093092] | committer: Reinhard Tartler

swscale: Fix an undefined behaviour

Prevent a division by zero down the codepath.

Sample-Id: 00001721-google
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable at libav.org
(cherry picked from commit 3a177a9cca924e097265b32f9282814f6b653e08)

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

 libswscale/utils.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libswscale/utils.c b/libswscale/utils.c
index 2111fc2..ea5f368 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -326,7 +326,7 @@ static av_cold int initFilter(int16_t **outFilter, int32_t **filterPos,
 
         xDstInSrc = xInc - 0x10000;
         for (i = 0; i < dstW; i++) {
-            int xx = (xDstInSrc - ((filterSize - 2) << 16)) / (1 << 17);
+            int xx = (xDstInSrc - ((int64_t)(filterSize - 2) << 16)) / (1 << 17);
             int j;
             (*filterPos)[i] = xx;
             for (j = 0; j < filterSize; j++) {



More information about the ffmpeg-cvslog mailing list