diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2019-08-08 19:30:50 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2020-01-06 11:30:43 +0100 |
commit | cd949baefde3ea76eea7ba0d3a22739ec6f1ad2a (patch) | |
tree | 74303701b8ea15127fc0ad3867b2eb2e920e2c84 | |
parent | 79dffb7f2cada156022200ebde505d7f8a9f5866 (diff) | |
download | ffmpeg-cd949baefde3ea76eea7ba0d3a22739ec6f1ad2a.tar.gz |
avcodec/vc1: Check for excessive resolution
Fixes: overflow in aspect ratio calculation
Fixes: signed integer overflow: 393215 * 14594 cannot be represented in type 'int'
Fixes: 15728/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMV3IMAGE_fuzzer-5661588893204480
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 181e138da7207523b387eabc28d24e74a46248bc)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/vc1.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libavcodec/vc1.c b/libavcodec/vc1.c index 242a54069c..ad965b1fa0 100644 --- a/libavcodec/vc1.c +++ b/libavcodec/vc1.c @@ -456,7 +456,11 @@ static int decode_sequence_header_adv(VC1Context *v, GetBitContext *gb) h = get_bits(gb, 8) + 1; v->s.avctx->sample_aspect_ratio = (AVRational){w, h}; } else { - av_reduce(&v->s.avctx->sample_aspect_ratio.num, + if (v->s.avctx->width > v->max_coded_width || + v->s.avctx->height > v->max_coded_height) { + avpriv_request_sample(v->s.avctx, "Huge resolution"); + } else + av_reduce(&v->s.avctx->sample_aspect_ratio.num, &v->s.avctx->sample_aspect_ratio.den, v->s.avctx->height * w, v->s.avctx->width * h, |