[FFmpeg-cvslog] avcodec/mpeg4videodec: more unsigned in amv computation

Michael Niedermayer git at videolan.org
Mon Sep 4 22:46:20 EEST 2023


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Thu Jun  1 23:35:10 2023 +0200| [0adaa90d89114dc86dbc5704ce31ded5b6750d13] | committer: Michael Niedermayer

avcodec/mpeg4videodec: more unsigned in amv computation

Fixes: signed integer overflow: -2147483648 + -1048576 cannot be represented in type 'int'
Fixes: 59365/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEG4_fuzzer-642654923954585

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=0adaa90d89114dc86dbc5704ce31ded5b6750d13
---

 libavcodec/mpeg4videodec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index 30aec5e529..f7f0ff59e8 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -861,7 +861,7 @@ static inline int get_amv(Mpeg4DecContext *ctx, int n)
         for (y = 0; y < 16; y++) {
             int v;
 
-            v = mb_v + dy * y;
+            v = mb_v + (unsigned)dy * y;
             // FIXME optimize
             for (x = 0; x < 16; x++) {
                 sum += v >> shift;



More information about the ffmpeg-cvslog mailing list