Browse Source

avcodec/pngdec: consider chunk size in minimal size check

assuming each block contains an empty chunk there has to be at least 8 bytes extra.

Fixes: 15327/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LSCR_fuzzer-5676669303521280
Fixes: Timeout (11->5sec)

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 70432eac0b)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
tags/n4.2.1
Michael Niedermayer 6 years ago
parent
commit
ee20e3ff2d
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      libavcodec/pngdec.c

+ 1
- 1
libavcodec/pngdec.c View File

@@ -1547,7 +1547,7 @@ 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)
if (bytestream2_get_bytes_left(gb) < 2 + nb_blocks * (12 + 8))
return AVERROR_INVALIDDATA;

if (s->last_picture.f->data[0]) {


Loading…
Cancel
Save