diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2017-05-28 14:30:46 +0300 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2017-06-16 02:05:28 +0300 |
commit | f5839a78266985d4c0bc23571e77cca81ee4bd85 (patch) | |
tree | 499984a20fb9710bbb91d594a8e259505ac49a0e | |
parent | b1da01c05169c7c11bdf69a638c9bed852e6fb21 (diff) |
avcodec/sheervideo: Check input buffer size before allocating and decoding
Fixes: Timeout
Fixes: 1858/clusterfuzz-testcase-minimized-6450473802399744
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 d8030c14bd7ac983b81ebe898631979f6b5aea09)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/sheervideo.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/sheervideo.c b/libavcodec/sheervideo.c index e8f008b7e4..b5c638ef6a 100644 --- a/libavcodec/sheervideo.c +++ b/libavcodec/sheervideo.c @@ -3105,6 +3105,11 @@ static int decode_frame(AVCodecContext *avctx, return AVERROR_PATCHWELCOME; } + if (avpkt->size < 20 + avctx->width * avctx->height / 16) { + av_log(avctx, AV_LOG_ERROR, "Input packet too small\n"); + return AVERROR_INVALIDDATA; + } + if (s->format != format) { if (ret < 0) return ret; |