1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avcodec/notchlc: Check uncompressed size against input for LZ4

Fixes: OOM
Fixes: 26168/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_NOTCHLC_fuzzer-6019839015256064
Fixes: 28397/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_NOTCHLC_fuzzer-5649039941042176

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2020-10-14 17:53:07 +02:00
parent ed524136e0
commit 32d0561891

View File

@ -496,6 +496,9 @@ static int decode_frame(AVCodecContext *avctx,
bytestream2_init(gb, s->lzf_buffer, uncompressed_size);
} else if (s->format == 1) {
if (bytestream2_get_bytes_left(gb) < uncompressed_size / 255)
return AVERROR_INVALIDDATA;
av_fast_padded_malloc(&s->uncompressed_buffer, &s->uncompressed_size,
uncompressed_size);
if (!s->uncompressed_buffer)