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

Git pushed a commit to branch master
in repository ffmpeg.

commit 3540a6a308256837da76ccebaa4987b33d2471eb
Author:     Andreas Rheinhardt <[email protected]>
AuthorDate: Tue Mar 24 11:29:37 2026 +0100
Commit:     Andreas Rheinhardt <[email protected]>
CommitDate: Sat Mar 28 11:25:38 2026 +0100

    avcodec/sbcenc: Don't output uninitialized data
    
    Check in init whether the parameters are valid.
    This can be triggered with
    ffmpeg -i tests/data/asynth-44100-2.wav -c sbc -sbc_delay 0.001 \
    -b:a 100k -f null -
    
    Signed-off-by: Andreas Rheinhardt <[email protected]>
---
 libavcodec/sbcenc.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/libavcodec/sbcenc.c b/libavcodec/sbcenc.c
index fb810c4c52..8534dc83ce 100644
--- a/libavcodec/sbcenc.c
+++ b/libavcodec/sbcenc.c
@@ -128,10 +128,6 @@ static size_t sbc_pack_frame(AVPacket *avpkt, struct 
sbc_frame *frame,
         avpkt->data[1] |= ((frame->subbands == 8)     & 0x01) << 0;
 
         avpkt->data[2] = frame->bitpool;
-
-        if (frame->bitpool > frame->subbands << (4 + (frame->mode == STEREO
-                                                   || frame->mode == 
JOINT_STEREO)))
-            return -5;
     }
 
     /* Can't fill in crc yet */
@@ -259,6 +255,12 @@ static av_cold int sbc_encode_init(AVCodecContext *avctx)
         if (avctx->global_quality > 0)
             frame->bitpool = avctx->global_quality / FF_QP2LAMBDA;
 
+        if (frame->bitpool > frame->subbands << (4 + (frame->mode == STEREO
+                                                   || frame->mode == 
JOINT_STEREO))) {
+            av_log(avctx, AV_LOG_ERROR, "Invalid parameter combination\n");
+            return AVERROR_PATCHWELCOME;
+        }
+
         avctx->frame_size = 4*((frame->subbands >> 3) + 1) * 4*(frame->blocks 
>> 2);
     }
 

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

Reply via email to