Commit bed125b7 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/diracdec: Check bytes count in else branch in decode_lowdelay() too

Fixes: signed integer overflow: 8 * 340018243 cannot be represented in type 'int'
Fixes: 9441/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DIRAC_fuzzer-5194665207791616

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpegSigned-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent f457c0ad
...@@ -986,6 +986,10 @@ static int decode_lowdelay(DiracContext *s) ...@@ -986,6 +986,10 @@ static int decode_lowdelay(DiracContext *s)
for (slice_x = 0; bufsize > 0 && slice_x < s->num_x; slice_x++) { for (slice_x = 0; bufsize > 0 && slice_x < s->num_x; slice_x++) {
bytes = (slice_num+1) * (int64_t)s->lowdelay.bytes.num / s->lowdelay.bytes.den bytes = (slice_num+1) * (int64_t)s->lowdelay.bytes.num / s->lowdelay.bytes.den
- slice_num * (int64_t)s->lowdelay.bytes.num / s->lowdelay.bytes.den; - slice_num * (int64_t)s->lowdelay.bytes.num / s->lowdelay.bytes.den;
if (bytes >= INT_MAX || bytes*8 > bufsize) {
av_log(s->avctx, AV_LOG_ERROR, "too many bytes\n");
return AVERROR_INVALIDDATA;
}
slices[slice_num].bytes = bytes; slices[slice_num].bytes = bytes;
slices[slice_num].slice_x = slice_x; slices[slice_num].slice_x = slice_x;
slices[slice_num].slice_y = slice_y; slices[slice_num].slice_y = slice_y;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment