[FFmpeg-cvslog] avcodec/clearvideo: Check buf_size before decoding frame
Michael Niedermayer
git at videolan.org
Fri Jun 2 03:08:10 EEST 2017
ffmpeg | branch: release/3.3 | Michael Niedermayer <michael at niedermayer.cc> | Fri May 26 01:37:14 2017 +0200| [4e8c5721b35615e9807d7452a663e8b07413c0e4] | committer: Michael Niedermayer
avcodec/clearvideo: Check buf_size before decoding frame
Fixes; Timeout
Fixes: 1826/clusterfuzz-testcase-minimized-5728569256837120
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 43c394dcaebe9eec5802b420f273385473380909)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4e8c5721b35615e9807d7452a663e8b07413c0e4
---
libavcodec/clearvideo.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/libavcodec/clearvideo.c b/libavcodec/clearvideo.c
index 060affeafd..f81090a675 100644
--- a/libavcodec/clearvideo.c
+++ b/libavcodec/clearvideo.c
@@ -297,6 +297,11 @@ static int clv_decode_frame(AVCodecContext *avctx, void *data,
c->pic->pict_type = frame_type & 0x20 ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;
if (frame_type & 0x2) {
+ if (buf_size < c->mb_width * c->mb_height) {
+ av_log(avctx, AV_LOG_ERROR, "Packet too small\n");
+ return AVERROR_INVALIDDATA;
+ }
+
bytestream2_get_be32(&gb); // frame size;
c->ac_quant = bytestream2_get_byte(&gb);
c->luma_dc_quant = 32;
More information about the ffmpeg-cvslog
mailing list