[FFmpeg-cvslog] swscale/swscale: fix integer overflow

Michael Niedermayer git at videolan.org
Thu Mar 27 13:03:05 CET 2014


ffmpeg | branch: release/2.2 | Michael Niedermayer <michaelni at gmx.at> | Mon Mar 24 05:01:32 2014 +0100| [a80a7131d11af69d2519377b35b58d8c8b3430af] | committer: Michael Niedermayer

swscale/swscale: fix integer overflow

Should fix fate failure with clang ftrapv

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit c9c0451224fd7bc38b4e135e99f114f80c1ae67f)

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libswscale/swscale.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index 1d623e7..f529331 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -208,8 +208,9 @@ static void lumRangeToJpeg16_c(int16_t *_dst, int width)
 {
     int i;
     int32_t *dst = (int32_t *) _dst;
-    for (i = 0; i < width; i++)
-        dst[i] = (FFMIN(dst[i], 30189 << 4) * 4769 - (39057361 << 2)) >> 12;
+    for (i = 0; i < width; i++) {
+        dst[i] = ((int)(FFMIN(dst[i], 30189 << 4) * 4769U - (39057361 << 2))) >> 12;
+    }
 }
 
 static void lumRangeFromJpeg16_c(int16_t *_dst, int width)



More information about the ffmpeg-cvslog mailing list