Commit aae470474f for ffmpeg

commit aae470474ffe2580ed83cc0b805903b826091b5f
Author: Michael Niedermayer <michael@niedermayer.cc>
Date:   Wed Nov 11 04:49:02 2026 +0100

    avcodec/vvc/dec: limit the slices of a picture to VVC_MAX_SLICES

    Fixes: excessive memory allocation
    Fixes: yGiQvHbsEdXd

    Found during the review of https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25491

diff --git a/libavcodec/vvc/dec.c b/libavcodec/vvc/dec.c
index f69fa99c6d..b2dcc853ac 100644
--- a/libavcodec/vvc/dec.c
+++ b/libavcodec/vvc/dec.c
@@ -953,6 +953,9 @@ static int decode_slice(VVCContext *s, VVCFrameContext *fc, AVBufferRef *buf_ref
     SliceContext *sc;
     const int is_first_slice = !fc->nb_slices;

+    if (fc->nb_slices >= VVC_MAX_SLICES)
+        return AVERROR_INVALIDDATA;
+
     ret = slices_realloc(fc);
     if (ret < 0)
         return ret;