]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/notchlc: Check uncompressed size against input for LZ4
authorMichael Niedermayer <michael@niedermayer.cc>
Wed, 14 Oct 2020 15:53:07 +0000 (17:53 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Sun, 3 Jan 2021 00:16:25 +0000 (01:16 +0100)
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>
libavcodec/notchlc.c

index 57ce70e9451d5635e22d5edc1becb57055d6f516..9a53cad9cb1e3bc3c87224450e890bd0bda3dab8 100644 (file)
@@ -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)