[FFmpeg-devel] [PATCH 2/3] avcodec/vqcdec: Check width & 15

Michael Niedermayer michael at niedermayer.cc
Mon Nov 28 00:34:34 EET 2022


Various parts of the code assume that width can be divided by various powers of 2
without rounding

Fixes: out of array access
Fixes: 53623/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VQC_fuzzer-6209269924233216

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

diff --git a/libavcodec/vqcdec.c b/libavcodec/vqcdec.c
index 18cd99462e..c3bce87974 100644
--- a/libavcodec/vqcdec.c
+++ b/libavcodec/vqcdec.c
@@ -71,6 +71,9 @@ static av_cold int vqc_decode_init(AVCodecContext * avctx)
     static AVOnce init_static_once = AV_ONCE_INIT;
     VqcContext *s = avctx->priv_data;
 
+    if (avctx->width & 15)
+        return AVERROR_PATCHWELCOME;
+
     s->vectors = av_malloc((avctx->width * avctx->height * 3) / 2);
     if (!s->vectors)
         return AVERROR(ENOMEM);
-- 
2.17.1



More information about the ffmpeg-devel mailing list