[FFmpeg-cvslog] avcodec/mpeg4videodec: Fix runtime error: shift exponent -2 is negative

Michael Niedermayer git at videolan.org
Sun Feb 19 22:51:08 EET 2017


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Sun Feb 19 21:33:27 2017 +0100| [aa2b75263e17651187b1475551a02aa2f4ff65fe] | committer: Michael Niedermayer

avcodec/mpeg4videodec: Fix runtime error: shift exponent -2 is negative

Fixes: 612/clusterfuzz-testcase-4707817137111040

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

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

 libavcodec/mpeg4videodec.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index 0e549ef..58ae05f 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -367,6 +367,12 @@ static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *g
     } else {
         int shift_y = 16 - ctx->sprite_shift[0];
         int shift_c = 16 - ctx->sprite_shift[1];
+
+        if (shift_c < 0 || shift_y < 0) {
+            avpriv_request_sample(s->avctx, "Too large sprite shift");
+            return AVERROR_PATCHWELCOME;
+        }
+
         for (i = 0; i < 2; i++) {
             s->sprite_offset[0][i] *= 1 << shift_y;
             s->sprite_offset[1][i] *= 1 << shift_c;



More information about the ffmpeg-cvslog mailing list