This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch release/9.1
in repository ffmpeg.

commit cb86f4952d26f56990669fc3ded4a498655e049b
Author:     Michael Niedermayer <[email protected]>
AuthorDate: Sat Oct 24 05:47:15 2026 +0200
Commit:     Michael Niedermayer <[email protected]>
CommitDate: Sun Nov 15 02:24:03 2026 +0100

    avcodec/libsvtjpegxsdec: check the dimensions before initializing the 
decoder
    
    Since the dimensions are now updated before the decoder is
    re-initialized, decoder_initialized is cleared when the old decoder is
    closed, so that a failed re-initialization cannot leave the closed
    decoder in use.
    
    Fixes: memleak
    Fixes: qEiTY2cyEBYu (AISLE-2026-0150-00638)
    Memory and thread leak Replicated through UnModified FFmpeg
    Found-by: Joshua Rogers <[email protected]>
    
    (cherry picked from commit 3aa561b0dd2054182fbb9548b4526e8500d52a52)
    Signed-off-by: Michael Niedermayer <[email protected]>
---
 libavcodec/libsvtjpegxsdec.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/libavcodec/libsvtjpegxsdec.c b/libavcodec/libsvtjpegxsdec.c
index 7a325c4446..8a80cd560d 100644
--- a/libavcodec/libsvtjpegxsdec.c
+++ b/libavcodec/libsvtjpegxsdec.c
@@ -118,8 +118,17 @@ static int svt_jpegxs_dec_decode(AVCodecContext* avctx, 
AVFrame* picture, int* g
 
     if (!svt_dec->decoder_initialized || ret != avctx->pix_fmt ||
         avctx->width != svt_dec->config.width || avctx->height != 
svt_dec->config.height) {
+        avctx->pix_fmt = ret;
+
+        ret = ff_set_dimensions(avctx, svt_dec->config.width, 
svt_dec->config.height);
+        if (ret < 0) {
+            av_log(avctx, AV_LOG_ERROR, "ff_set_dimensions failed, err=%d\n", 
ret);
+            return ret;
+        }
+
         if (svt_dec->decoder_initialized)
             svt_jpeg_xs_decoder_close(&svt_dec->decoder);
+        svt_dec->decoder_initialized = 0;
         err = svt_jpeg_xs_decoder_init(SVT_JPEGXS_API_VER_MAJOR, 
SVT_JPEGXS_API_VER_MINOR,
                                        &svt_dec->decoder, avpkt->data, 
avpkt->size, &svt_dec->config);
         if (err) {
@@ -127,14 +136,6 @@ static int svt_jpegxs_dec_decode(AVCodecContext* avctx, 
AVFrame* picture, int* g
             return AVERROR_EXTERNAL;
         }
 
-        avctx->pix_fmt = ret;
-
-        ret = ff_set_dimensions(avctx, svt_dec->config.width, 
svt_dec->config.height);
-        if (ret < 0) {
-            av_log(avctx, AV_LOG_ERROR, "ff_set_dimensions failed, err=%d\n", 
ret);
-            return ret;
-        }
-
         svt_dec->decoder_initialized = 1;
     }
 

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to