[FFmpeg-cvslog] avcodec/mss4: Check image size with av_image_check_size2()

Michael Niedermayer git at videolan.org
Thu Sep 1 18:15:37 EEST 2022


ffmpeg | branch: release/5.0 | Michael Niedermayer <michael at niedermayer.cc> | Sun Jul  3 00:34:08 2022 +0200| [b821f224fbc509b9b665af36bfa631cf18cd97c1] | committer: Michael Niedermayer

avcodec/mss4: Check image size with av_image_check_size2()

Fixes: Timeout
Fixes: 48418/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MTS2_fuzzer-4834851466903552

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 4e145f1dcdcbe19e8f8e98940dab04e9332a8b5b)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavcodec/mss4.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/mss4.c b/libavcodec/mss4.c
index 216df2852d..51d11f328d 100644
--- a/libavcodec/mss4.c
+++ b/libavcodec/mss4.c
@@ -26,6 +26,7 @@
  */
 
 #include "libavutil/thread.h"
+#include "libavutil/imgutils.h"
 
 #include "avcodec.h"
 #include "bytestream.h"
@@ -476,6 +477,9 @@ static int mss4_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
                width, height);
         return AVERROR_INVALIDDATA;
     }
+    if (av_image_check_size2(width, height, avctx->max_pixels, AV_PIX_FMT_NONE, 0, avctx) < 0)
+        return AVERROR_INVALIDDATA;
+
     if (quality < 1 || quality > 100) {
         av_log(avctx, AV_LOG_ERROR, "Invalid quality setting %d\n", quality);
         return AVERROR_INVALIDDATA;



More information about the ffmpeg-cvslog mailing list