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>
This commit is contained in:
Michael Niedermayer 2024-08-19 20:37:56 +02:00
parent 01910ca603
commit b9c7f50c7d
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64
1 changed files with 3 additions and 0 deletions

View File

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