Browse Source

avcodec/msvideo1: Check buffer size before re-getting the frame

Fixes timeout
Fixes: 1306/clusterfuzz-testcase-minimized-6152296217968640

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit cabfed6895)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
tags/n3.0.8
Michael Niedermayer 8 years ago
parent
commit
32f047ce5c
1 changed files with 6 additions and 0 deletions
  1. +6
    -0
      libavcodec/msvideo1.c

+ 6
- 0
libavcodec/msvideo1.c View File

@@ -302,6 +302,12 @@ static int msvideo1_decode_frame(AVCodecContext *avctx,
s->buf = buf;
s->size = buf_size;

// Discard frame if its smaller than the minimum frame size
if (buf_size < (avctx->width/4) * (avctx->height/4) / 512) {
av_log(avctx, AV_LOG_ERROR, "Packet is too small\n");
return AVERROR_INVALIDDATA;
}

if ((ret = ff_reget_buffer(avctx, s->frame)) < 0)
return ret;



Loading…
Cancel
Save