[FFmpeg-devel] [PATCH 8/9] avcodec/smcenc: width < 4 is unsupported

Michael Niedermayer michael at niedermayer.cc
Mon Jun 17 02:08:30 EEST 2024


Fixes: out of array read
Fixes: 68939/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SMC_fuzzer-587804104884224

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/smcenc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/smcenc.c b/libavcodec/smcenc.c
index 789aef4f770..d70cce900ec 100644
--- a/libavcodec/smcenc.c
+++ b/libavcodec/smcenc.c
@@ -537,6 +537,9 @@ static int smc_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
     uint8_t *pal;
     int ret;
 
+    if (avctx->width < 4)
+        return AVERROR_PATCHWELCOME;
+
     ret = ff_alloc_packet(avctx, pkt, 8LL * avctx->height * avctx->width);
     if (ret < 0)
         return ret;
-- 
2.45.2



More information about the ffmpeg-devel mailing list