aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-02-23 22:33:16 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2017-05-17 20:35:19 +0200
commit2e7621d615c5e66b8ad73ebd763e6c2faf14e52c (patch)
tree85d224c4c101a436293ac3483b4341cacc5a185e
parentc66899d5e43088b48faafba2e44f7df41ef2eb63 (diff)
downloadffmpeg-2e7621d615c5e66b8ad73ebd763e6c2faf14e52c.tar.gz
avcodec/mpeg4videodec: Check the other 3 sprite points for intermediate overflows
This is not necessarily specific to fuzzed files Fixes: Multiple integer overflows Fixes: 656/clusterfuzz-testcase-6463814516080640 Fixes: 658/clusterfuzz-testcase-6691260146384896 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 76ba09d18245a2a41dc5f93a60fd00cdf358cb1f) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/mpeg4videodec.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index eeb26381d1..76447035af 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -384,6 +384,13 @@ static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *g
s->sprite_delta[0][i] *= 1 << shift_y;
s->sprite_delta[1][i] *= 1 << shift_y;
ctx->sprite_shift[i] = 16;
+
+ if (llabs(s->sprite_offset[i][0] + s->sprite_delta[i][0] * (int64_t)w) >= INT_MAX ||
+ llabs(s->sprite_offset[i][0] + s->sprite_delta[i][1] * (int64_t)h) >= INT_MAX ||
+ llabs(s->sprite_offset[i][0] + s->sprite_delta[i][0] * (int64_t)w + s->sprite_delta[i][1] * (int64_t)h) >= INT_MAX) {
+ avpriv_request_sample(s->avctx, "Overflow on sprite points");
+ return AVERROR_PATCHWELCOME;
+ }
}
s->real_sprite_warping_points = ctx->num_sprite_warping_points;
}