aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-10-14 17:53:07 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2021-01-03 01:16:25 +0100
commit32d0561891e1a78f9bd18ad667ca526ab1600a06 (patch)
tree9b91b42a19c34af9bf1adb8c2ff807cef7826217
parented524136e0d0ae26c9f11df42baf72689499f99f (diff)
downloadffmpeg-32d0561891e1a78f9bd18ad667ca526ab1600a06.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 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>
-rw-r--r--libavcodec/notchlc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/notchlc.c b/libavcodec/notchlc.c
index 57ce70e945..9a53cad9cb 100644
--- a/libavcodec/notchlc.c
+++ b/libavcodec/notchlc.c
@@ -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)