diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2017-05-04 15:24:46 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2017-05-04 17:15:43 +0200 |
commit | cabfed6895fcc679cd6a6244a12d800e0f3f2d20 (patch) | |
tree | 4d85241f56d8cb3cde3f5290f9233cf049616568 /libavcodec/msvideo1.c | |
parent | 92f4a4bf29d730d853bbcb2d229b1695df5a1892 (diff) | |
download | ffmpeg-cabfed6895fcc679cd6a6244a12d800e0f3f2d20.tar.gz |
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>
Diffstat (limited to 'libavcodec/msvideo1.c')
-rw-r--r-- | libavcodec/msvideo1.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/msvideo1.c b/libavcodec/msvideo1.c index a49b9be364..29700f54b6 100644 --- a/libavcodec/msvideo1.c +++ b/libavcodec/msvideo1.c @@ -301,6 +301,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; |