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

Michael Niedermayer git at videolan.org
Mon Oct 30 02:10:33 EET 2023


ffmpeg | branch: release/5.1 | Michael Niedermayer <michael at niedermayer.cc> | Thu Jun  1 23:35:10 2023 +0200| [06ff2bfe0f29ae6fa817ea6457cd775e88780e48] | 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=06ff2bfe0f29ae6fa817ea6457cd775e88780e48
---

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

diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index 724c6aacf3..b04ec1388e 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -685,7 +685,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