diff mbox series

[FFmpeg-devel,4/4] avcodec/mobiclip: Check mv against INT_MAX

Message ID 20201114222628.6486-4-michael@niedermayer.cc
State Accepted
Commit a108a4d809f8345303e1aa7578d608a726c53686
Headers show
Series [FFmpeg-devel,1/4] avformat/iff: Check size before skip
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Michael Niedermayer Nov. 14, 2020, 10:26 p.m. UTC
Fixes: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int'
Fixes: 27369/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MOBICLIP_fuzzer-5083469356728320

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/mobiclip.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/libavcodec/mobiclip.c b/libavcodec/mobiclip.c
index 9fa88e84a0..8504959b22 100644
--- a/libavcodec/mobiclip.c
+++ b/libavcodec/mobiclip.c
@@ -1146,6 +1146,8 @@  static int predict_motion(AVCodecContext *avctx,
             mv.x = mv.x + get_se_golomb(gb);
             mv.y = mv.y + get_se_golomb(gb);
         }
+        if (mv.x >= INT_MAX || mv.y >= INT_MAX)
+            return AVERROR_INVALIDDATA;
 
         motion[offsetm].x = mv.x;
         motion[offsetm].y = mv.y;