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

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

commit 37559db49951047479e4f77468517cfe69aec82f
Author:     Michael Niedermayer <[email protected]>
AuthorDate: Tue Mar 3 18:10:28 2026 +0100
Commit:     Michael Niedermayer <[email protected]>
CommitDate: Mon May 4 17:13:26 2026 +0200

    swscale/utils: initialize chroma when luma switched to cascade
    
    When luma init switched to cascade the chroma init was skiped
    
    Fixes: NULL pointer dereference
    Fixes: #21583
    
    Found-by: HAORAN FANG
    Signed-off-by: Michael Niedermayer <[email protected]>
    (cherry picked from commit dc9bf66796b7c1f4329f127736ddf3258e5ba206)
    Signed-off-by: Michael Niedermayer <[email protected]>
---
 libswscale/utils.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/libswscale/utils.c b/libswscale/utils.c
index 94c541b676..99b356feb0 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -1860,13 +1860,15 @@ static av_cold int sws_init_single_context(SwsContext 
*c, SwsFilter *srcFilter,
                                 PPC_ALTIVEC(cpu_flags) ? 8 :
                                 have_neon(cpu_flags)   ? 2 : 1;
 
-        if ((ret = initFilter(&c->vLumFilter, &c->vLumFilterPos, 
&c->vLumFilterSize,
+        ret = initFilter(&c->vLumFilter, &c->vLumFilterPos, &c->vLumFilterSize,
                        c->lumYInc, srcH, dstH, filterAlign, (1 << 12),
                        (flags & SWS_BICUBLIN) ? (flags | SWS_BICUBIC) : flags,
                        cpu_flags, srcFilter->lumV, dstFilter->lumV,
                        c->param,
                        get_local_pos(c, 0, 0, 1),
-                       get_local_pos(c, 0, 0, 1))) < 0)
+                       get_local_pos(c, 0, 0, 1));
+        int usecascade = (ret == RETCODE_USE_CASCADE);
+        if (ret < 0 && !usecascade)
             goto fail;
         if ((ret = initFilter(&c->vChrFilter, &c->vChrFilterPos, 
&c->vChrFilterSize,
                        c->chrYInc, c->chrSrcH, c->chrDstH,
@@ -1878,6 +1880,10 @@ static av_cold int sws_init_single_context(SwsContext 
*c, SwsFilter *srcFilter,
                        get_local_pos(c, c->chrDstVSubSample, c->dst_v_chr_pos, 
1))) < 0)
 
             goto fail;
+        if (usecascade) {
+            ret = RETCODE_USE_CASCADE;
+            goto fail;
+        }
 
 #if HAVE_ALTIVEC
         c->vYCoeffsBank = av_malloc_array(c->dstH, c->vLumFilterSize * 
sizeof(*c->vYCoeffsBank));

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to