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

Michael Niedermayer git at videolan.org
Sun Apr 14 23:58:05 EEST 2024


ffmpeg | branch: release/3.4 | Michael Niedermayer <michael at niedermayer.cc> | Thu Jun  1 23:35:10 2023 +0200| [1c9ae4ada69fe14991767085ae4504f42d3b5783] | 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>
(cherry picked from commit 0adaa90d89114dc86dbc5704ce31ded5b6750d13)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

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

diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index 81a73a466f..5174a3a1b6 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -557,7 +557,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