mirror of
https://github.com/xenia-project/FFmpeg.git
synced 2024-11-25 04:30:02 +00:00
avcodec/notchlc: Check uncompressed size against input for LZ4
Fixes: OOM Fixes: 26168/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_NOTCHLC_fuzzer-6019839015256064 Equation is based on LZ4_COMPRESSBOUND from lz4.h Suggested-by: Paul 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:
parent
0d088a47ca
commit
51002362c4
@ -490,6 +490,11 @@ static int decode_frame(AVCodecContext *avctx,
|
|||||||
|
|
||||||
bytestream2_init(gb, s->lzf_buffer, uncompressed_size);
|
bytestream2_init(gb, s->lzf_buffer, uncompressed_size);
|
||||||
} else if (s->format == 1) {
|
} else if (s->format == 1) {
|
||||||
|
unsigned remaining = bytestream2_get_bytes_left(gb);
|
||||||
|
|
||||||
|
if (remaining > 0x7E000000U || remaining + remaining/255 + 16 < uncompressed_size)
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
|
||||||
av_fast_padded_malloc(&s->uncompressed_buffer, &s->uncompressed_size,
|
av_fast_padded_malloc(&s->uncompressed_buffer, &s->uncompressed_size,
|
||||||
uncompressed_size);
|
uncompressed_size);
|
||||||
if (!s->uncompressed_buffer)
|
if (!s->uncompressed_buffer)
|
||||||
|
Loading…
Reference in New Issue
Block a user