[FFmpeg-cvslog] avcodec/mobiclip: Fix multiple integer overflows

Michael Niedermayer git at videolan.org
Sun Oct 11 17:47:30 EEST 2020


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Tue Sep 29 22:43:13 2020 +0200| [0aa1645140e69a092150cd4e1c7e54321f6cfd12] | committer: Michael Niedermayer

avcodec/mobiclip: Fix multiple integer overflows

Fixes: signed integer overflow: 872415232 * 7 cannot be represented in type 'int'
Fixes: signed integer overflow: -2013265888 + -1744830464 cannot be represented in type 'int'
Fixes: 25834/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MOBICLIP_fuzzer-5471406434025472

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavcodec/mobiclip.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/libavcodec/mobiclip.c b/libavcodec/mobiclip.c
index f890cb2599..0f150a551a 100644
--- a/libavcodec/mobiclip.c
+++ b/libavcodec/mobiclip.c
@@ -407,12 +407,12 @@ static int setup_qtables(AVCodecContext *avctx, int quantizer)
     return 0;
 }
 
-static void inverse4(int *rs)
+static void inverse4(unsigned *rs)
 {
-    int a = rs[0] + rs[2];
-    int b = rs[0] - rs[2];
-    int c = rs[1] + (rs[3] >> 1);
-    int d = (rs[1] >> 1) - rs[3];
+    unsigned a = rs[0] + rs[2];
+    unsigned b = rs[0] - rs[2];
+    unsigned c = rs[1] + ((int)rs[3] >> 1);
+    unsigned d = ((int)rs[1] >> 1) - rs[3];
 
     rs[0] = a + c;
     rs[1] = b + d;
@@ -519,7 +519,7 @@ static int add_coefficients(AVCodecContext *avctx, AVFrame *frame,
         if (pos >= size * size)
             return AVERROR_INVALIDDATA;
         qval = qtab[pos];
-        mat[ztab[pos]] = qval * level;
+        mat[ztab[pos]] = qval *(unsigned)level;
 
         if (last)
             break;



More information about the ffmpeg-cvslog mailing list