[FFmpeg-cvslog] avcodec/sheervideo: Check input buffer size before allocating and decoding

Michael Niedermayer git at videolan.org
Sun Jun 18 17:28:54 EEST 2017


ffmpeg | branch: release/3.1 | Michael Niedermayer <michael at niedermayer.cc> | Sun May 28 13:30:46 2017 +0200| [efa7ce36e372e458b534529bb7d0a21b89368ad6] | committer: Michael Niedermayer

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 at niedermayer.cc>
(cherry picked from commit d8030c14bd7ac983b81ebe898631979f6b5aea09)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=efa7ce36e372e458b534529bb7d0a21b89368ad6
---

 libavcodec/sheervideo.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/sheervideo.c b/libavcodec/sheervideo.c
index 2f08b7bff0..5b03ce4431 100644
--- a/libavcodec/sheervideo.c
+++ b/libavcodec/sheervideo.c
@@ -3098,6 +3098,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;



More information about the ffmpeg-cvslog mailing list