avcodec/notchlc: Check bytes left before reading

Fixes: Use of uninitialized value
Fixes: 71230/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_NOTCHLC_fuzzer-4624502095413248

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit b9c7f50c7d)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer
2024-08-19 20:37:56 +02:00
parent f2d7b8089f
commit d349ad7bb6

View File

@@ -92,6 +92,9 @@ static int lz4_decompress(AVCodecContext *avctx,
} while (current == 255);
}
if (bytestream2_get_bytes_left(gb) < num_literals)
return AVERROR_INVALIDDATA;
if (pos + num_literals < HISTORY_SIZE) {
bytestream2_get_buffer(gb, history + pos, num_literals);
pos += num_literals;