PR #24681 opened by Marvin Scholz (ePirat) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24681 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24681.patch
# Summary of changes - Zero initialize the active/redundancy arrays in opus silk to prevent MSan errors. - Add a FATE test sample that actually tests the opus silk mono code-path. ```fate-samples opus/silk-lbrr-mono.mka opus/silk-lbrr-mono.dec ``` >From 3346705c3cadd373bc62ca8cf213df3e9434ef94 Mon Sep 17 00:00:00 2001 From: Vitaly Sokolov <[email protected]> Date: Thu, 24 Sep 2026 21:22:28 +0000 Subject: [PATCH 1/2] avcodec/opus/silk: zero-initialize active and redundancy arrays In ff_silk_decode_superframe, when coded_channels is 1, redundancy[1] and active[1] are not read from the bitstream. However, decoding LBRR frames accesses redundancy[1] when j == 0: int active1 = (j == 0 && !(redundancy[1] & (1 << i))) ? 0 : 1; which causes an uninitialized variable read under MemorySanitizer. Zero-initialize the active and redundancy arrays to prevent reading uninitialized values. Signed-off-by: Vitaly Sokolov <[email protected]> Signed-off-by: Marvin Scholz <[email protected]> --- libavcodec/opus/silk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/opus/silk.c b/libavcodec/opus/silk.c index f7b79fff45..9327178e77 100644 --- a/libavcodec/opus/silk.c +++ b/libavcodec/opus/silk.c @@ -789,7 +789,7 @@ int ff_silk_decode_superframe(SilkContext *s, OpusRangeCoder *rc, int coded_channels, int duration_ms) { - int active[2][6], redundancy[2]; + int active[2][6] = {{0}}, redundancy[2] = {0}; int nb_frames, i, j; if (bandwidth > OPUS_BANDWIDTH_WIDEBAND || -- 2.52.0 >From ea64e8eefcc2a0b6f4661a067a8449eae46196dd Mon Sep 17 00:00:00 2001 From: Marvin Scholz <[email protected]> Date: Thu, 24 Sep 2026 22:59:24 +0000 Subject: [PATCH 2/2] tests/fate/opus: add mono SILK LBRR test Add silk-lbrr-mono to OPUS_SILK_SAMPLES to test decoding mono SILK frames with Low Bit-Rate Redundancy. This covers the code path where coded_channels is 1 and redundancy was previously read uninitialized. Signed-off-by: Marvin Scholz <[email protected]> --- tests/fate/opus.mak | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/fate/opus.mak b/tests/fate/opus.mak index bc7aea90d5..b07473515a 100644 --- a/tests/fate/opus.mak +++ b/tests/fate/opus.mak @@ -4,7 +4,7 @@ OPUS_CELT_SAMPLES = $(addprefix testvector, 01 11) tron.6ch.tinypkts OPUS_HYBRID_SAMPLES = $(addprefix testvector, 05 06) -OPUS_SILK_SAMPLES = $(addprefix testvector, 02 03 04) silk-lbrr +OPUS_SILK_SAMPLES = $(addprefix testvector, 02 03 04) silk-lbrr silk-lbrr-mono OPUS_OTHER_SAMPLES = $(addprefix testvector, 07 08 09 10 12) define FATE_OPUS_TEST @@ -34,6 +34,7 @@ fate-opus-testvector10: CMP_TARGET = 38 fate-opus-testvector11: CMP_TARGET = 0 fate-opus-testvector12: CMP_TARGET = 160 fate-opus-silk-lbrr: CMP_TARGET = 0 +fate-opus-silk-lbrr-mono: CMP_TARGET = 0 fate-opus-tron.6ch.tinypkts: CMP_SHIFT = 1440 fate-opus-tron.6ch.tinypkts: CMP_TARGET = 0 -- 2.52.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
