diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2018-07-22 21:42:16 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2018-11-18 02:20:44 +0100 |
commit | 7a7a6bf8e25054f599d274831f6993ac86267cf2 (patch) | |
tree | ca536753615feaa24b5f0969ce74416678338767 | |
parent | ec7cf0c74f75089617696f7f6e6787760997dcc0 (diff) | |
download | ffmpeg-7a7a6bf8e25054f599d274831f6993ac86267cf2.tar.gz |
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/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit bed125b7108481574f36fdd6ee699b27354602e8)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/diracdec.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c index 081a3118be..33927c26b3 100644 --- a/libavcodec/diracdec.c +++ b/libavcodec/diracdec.c @@ -979,6 +979,10 @@ static int decode_lowdelay(DiracContext *s) 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 - 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].slice_x = slice_x; slices[slice_num].slice_y = slice_y; |