[FFmpeg-cvslog] avcodec/notchlc: Check uncompressed size against input for LZ4

Michael Niedermayer git at videolan.org
Sun Jan 3 02:16:58 EET 2021


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Wed Oct 14 17:53:07 2020 +0200| [32d0561891e1a78f9bd18ad667ca526ab1600a06] | committer: Michael Niedermayer

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 at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=32d0561891e1a78f9bd18ad667ca526ab1600a06
---

 libavcodec/notchlc.c | 3 +++
 1 file changed, 3 insertions(+)

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)



More information about the ffmpeg-cvslog mailing list