[FFmpeg-cvslog] avcodec/mpeg4videodec: Check sprite delta upshift against overflowing.
Michael Niedermayer
git at videolan.org
Sun Jun 18 17:36:11 EEST 2017
ffmpeg | branch: release/3.1 | Michael Niedermayer <michael at niedermayer.cc> | Wed Jun 14 23:55:17 2017 +0200| [5d609474f3b5196f33204dc572cf4914d88cda2e] | committer: Michael Niedermayer
avcodec/mpeg4videodec: Check sprite delta upshift against overflowing.
Fixes: runtime error: signed integer overflow: -268386304 * 16 cannot be represented in type 'int'
Fixes: 2204/clusterfuzz-testcase-minimized-5616756909408256
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 12245ab1f677074b8ff83e87f76a41aba692ccd6)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5d609474f3b5196f33204dc572cf4914d88cda2e
---
libavcodec/mpeg4videodec.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index 96c5b7b6fd..ba2d0a33df 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -361,14 +361,16 @@ static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *g
int shift_y = 16 - ctx->sprite_shift[0];
int shift_c = 16 - ctx->sprite_shift[1];
- if (shift_c < 0 || shift_y < 0 ||
- FFABS(sprite_offset[0][0]) >= INT_MAX >> shift_y ||
- FFABS(sprite_offset[1][0]) >= INT_MAX >> shift_c ||
- FFABS(sprite_offset[0][1]) >= INT_MAX >> shift_y ||
- FFABS(sprite_offset[1][1]) >= INT_MAX >> shift_c
- ) {
- avpriv_request_sample(s->avctx, "Too large sprite shift or offset");
- goto overflow;
+ for (i = 0; i < 2; i++) {
+ if (shift_c < 0 || shift_y < 0 ||
+ FFABS( sprite_offset[0][i]) >= INT_MAX >> shift_y ||
+ FFABS( sprite_offset[1][i]) >= INT_MAX >> shift_c ||
+ FFABS(s->sprite_delta[0][i]) >= INT_MAX >> shift_y ||
+ FFABS(s->sprite_delta[1][i]) >= INT_MAX >> shift_y
+ ) {
+ avpriv_request_sample(s->avctx, "Too large sprite shift, delta or offset");
+ goto overflow;
+ }
}
for (i = 0; i < 2; i++) {
More information about the ffmpeg-cvslog
mailing list