[FFmpeg-devel] [PATCH 1/2] avcodec/midivid: Check dimensions to be the multiple assumed by the implementation

Michael Niedermayer michael at niedermayer.cc
Thu Feb 13 00:03:18 EET 2020


Fixes: out of array access
Fixes: 20626/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MVDV_fuzzer-6279905350516736

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavcodec/midivid.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/midivid.c b/libavcodec/midivid.c
index 8d4c3b369e..a30cf25207 100644
--- a/libavcodec/midivid.c
+++ b/libavcodec/midivid.c
@@ -236,6 +236,9 @@ static av_cold int decode_init(AVCodecContext *avctx)
     MidiVidContext *s = avctx->priv_data;
     int ret = av_image_check_size(avctx->width, avctx->height, 0, avctx);
 
+    if (avctx->width%32 || avctx->height%4)
+        ret = AVERROR_INVALIDDATA;
+
     if (ret < 0) {
         av_log(avctx, AV_LOG_ERROR, "Invalid image size %dx%d.\n",
                avctx->width, avctx->height);
-- 
2.17.1



More information about the ffmpeg-devel mailing list