aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-10-13 22:44:21 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2020-10-20 15:33:13 +0200
commit51002362c4ed301e54cea1597666cd5cc9a134f3 (patch)
treeeeeb89dc4d41e1374a1f909a5f849bbe3e91780e
parent0d088a47ca0243576078f109fff20617d1fac382 (diff)
downloadffmpeg-51002362c4ed301e54cea1597666cd5cc9a134f3.tar.gz
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>
-rw-r--r--libavcodec/notchlc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/notchlc.c b/libavcodec/notchlc.c
index 3f7079da70..d13ce3193c 100644
--- a/libavcodec/notchlc.c
+++ b/libavcodec/notchlc.c
@@ -490,6 +490,11 @@ static int decode_frame(AVCodecContext *avctx,
bytestream2_init(gb, s->lzf_buffer, uncompressed_size);
} 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,
uncompressed_size);
if (!s->uncompressed_buffer)