avcodec/pngdec: Check nb_blocks

Fixes: Timeout (23sec -> 0.5sec)
Fixes: 14329/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LSCR_fuzzer-5679252923482112

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2019-04-27 23:49:33 +02:00
parent 1eb54323c8
commit 4fd74a2b10
1 changed files with 2 additions and 0 deletions

View File

@ -1541,6 +1541,8 @@ static int decode_frame_lscr(AVCodecContext *avctx,
return ret;
nb_blocks = bytestream2_get_le16(gb);
if (bytestream2_get_bytes_left(gb) < 2 + nb_blocks * 12)
return AVERROR_INVALIDDATA;
if (s->last_picture.f->data[0]) {
ret = av_frame_copy(frame, s->last_picture.f);