PR #23284 opened by Kacper Michajłow (kasper93)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23284
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23284.patch

Silent frames return early from ff_opus_psy_celt_frame_init before
intensity_stereo is set, but postencode_update reads it into
avg_is_band, causing a use-of-uninitialized-value. Set it to end_band
like the non-silent path does.

Signed-off-by: Kacper Michajłow <[email protected]>


From a29074b1a3769a1b15a797783dbdb5093d3cd79d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <[email protected]>
Date: Sun, 31 May 2026 04:01:14 +0200
Subject: [PATCH] avcodec/opus/enc_psy: init intensity_stereo for silent frames
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Silent frames return early from ff_opus_psy_celt_frame_init before
intensity_stereo is set, but postencode_update reads it into
avg_is_band, causing a use-of-uninitialized-value. Set it to end_band
like the non-silent path does.

Signed-off-by: Kacper Michajłow <[email protected]>
---
 libavcodec/opus/enc_psy.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/opus/enc_psy.c b/libavcodec/opus/enc_psy.c
index ae9ae021d8..a7a1f1ff8e 100644
--- a/libavcodec/opus/enc_psy.c
+++ b/libavcodec/opus/enc_psy.c
@@ -312,6 +312,7 @@ void ff_opus_psy_celt_frame_init(OpusPsyContext *s, 
CeltFrame *f, int index)
     f->silence = silence;
     if (f->silence) {
         f->framebits = 0; /* Otherwise the silence flag eats up 16(!) bits */
+        f->intensity_stereo = f->end_band; /* Read by postencode_update for 
avg_is_band */
         return;
     }
 
-- 
2.52.0

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

Reply via email to