diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2017-02-19 21:33:27 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2017-05-17 20:35:19 +0200 |
commit | a18c76cb783f9e0993ab704fdd1f1b9500959901 (patch) | |
tree | c45342e6695daa816bb40ece35e4dc4419da5960 | |
parent | 97bbd8e8d3433c0f384b636bb03f09b080092226 (diff) | |
download | ffmpeg-a18c76cb783f9e0993ab704fdd1f1b9500959901.tar.gz |
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@niedermayer.cc>
(cherry picked from commit aa2b75263e17651187b1475551a02aa2f4ff65fe)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/mpeg4videodec.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index e9f54bd3d2..e9353aab5d 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; |