[FFmpeg-devel] [PATCH 01/11] avcodec/notchlc: Check uncompressed size against input for LZ4

Michael Niedermayer michael at niedermayer.cc
Tue Oct 20 23:56:09 EEST 2020


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

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavcodec/notchlc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/notchlc.c b/libavcodec/notchlc.c
index 3f7079da70..0254e7d76a 100644
--- a/libavcodec/notchlc.c
+++ b/libavcodec/notchlc.c
@@ -490,6 +490,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)
-- 
2.17.1



More information about the ffmpeg-devel mailing list