[FFmpeg-devel] [PATCH] avcodec/libxvid: add check for invalid intra/inter matrix values

Marton Balint cus at passwd.hu
Sat Jan 25 21:50:25 EET 2025


Signed-off-by: Marton Balint <cus at passwd.hu>
---
 libavcodec/libxvid.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/libxvid.c b/libavcodec/libxvid.c
index fbd33b7065..850e691403 100644
--- a/libavcodec/libxvid.c
+++ b/libavcodec/libxvid.c
@@ -617,6 +617,10 @@ static av_cold int xvid_encode_init(AVCodecContext *avctx)
     x->intra_matrix =
     x->inter_matrix = NULL;
 
+    ret = ff_check_codec_matrices(avctx, FF_MATRIX_TYPE_INTRA | FF_MATRIX_TYPE_INTER, 1, 255);
+    if (ret < 0)
+        return ret;
+
     if (x->mpeg_quant)
         x->vol_flags |= XVID_VOL_MPEGQUANT;
     if ((avctx->intra_matrix || avctx->inter_matrix)) {
-- 
2.43.0



More information about the ffmpeg-devel mailing list