[PR] avfilter/af_arnndn: pad the DCT input buffers to the read length (PR #23913)

michaelni via ffmpeg-devel <[email protected]> Sat, 25 Jul 2026 15:14:30 -0000
Newsgroups gmane.comp.video.ffmpeg.devel
Message-ID <178499247066.59.3927419899910421584@29965ddac10e>
PR #23913 opened by michaelni
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23913
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23913.patch

Fixes: out of array access
Fixes: SUcVEyk7r3Gc
Found-by: Kenan Alghythee <[email protected]>



>From 1d245e4684bf55704aa914834ec624ba8fe4e02f Mon Sep 17 00:00:00 2001
From: Michael Niedermayer <[email protected]>
Date: Sat, 11 Jul 2026 16:59:59 +0200
Subject: [PATCH] avfilter/af_arnndn: pad the DCT input buffers to the read
 length

Fixes: out of array access
Fixes: SUcVEyk7r3Gc
Found-by: Kenan Alghythee <[email protected]>
---
 libavfilter/af_arnndn.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavfilter/af_arnndn.c b/libavfilter/af_arnndn.c
index 5d516f0b15..6209f1b0e0 100644
--- a/libavfilter/af_arnndn.c
+++ b/libavfilter/af_arnndn.c
@@ -1023,7 +1023,7 @@ static int compute_frame_features(AudioRNNContext *s, DenoiseState *st, AVComple
     float E = 0;
     float *ceps_0, *ceps_1, *ceps_2;
     float spec_variability = 0;
-    LOCAL_ALIGNED_32(float, Ly, [NB_BANDS]);
+    LOCAL_ALIGNED_32(float, Ly, [FFALIGN(NB_BANDS, 4)]);
     LOCAL_ALIGNED_32(float, p, [WINDOW_SIZE]);
     float pitch_buf[PITCH_BUF_SIZE>>1];
     int pitch_index;
@@ -1057,6 +1057,7 @@ static int compute_frame_features(AudioRNNContext *s, DenoiseState *st, AVComple
     for (int i = 0; i < NB_BANDS; i++)
         Exp[i] = Exp[i] / sqrtf(.001f+Ex[i]*Ep[i]);
 
+    memset(Exp + NB_BANDS, 0, (FFALIGN(NB_BANDS, 4) - NB_BANDS) * sizeof(*Exp));
     dct(s, tmp, Exp);
 
     for (int i = 0; i < NB_DELTA_CEPS; i++)
@@ -1082,6 +1083,7 @@ static int compute_frame_features(AudioRNNContext *s, DenoiseState *st, AVComple
         return 1;
     }
 
+    memset(Ly + NB_BANDS, 0, (FFALIGN(NB_BANDS, 4) - NB_BANDS) * sizeof(*Ly));
     dct(s, features, Ly);
     features[0] -= 12;
     features[1] -= 4;
@@ -1364,7 +1366,7 @@ static float rnnoise_channel(AudioRNNContext *s, DenoiseState *st, float *out, c
     AVComplexFloat P[WINDOW_SIZE];
     float x[FRAME_SIZE];
     float Ex[NB_BANDS], Ep[NB_BANDS];
-    LOCAL_ALIGNED_32(float, Exp, [NB_BANDS]);
+    LOCAL_ALIGNED_32(float, Exp, [FFALIGN(NB_BANDS, 4)]);
     float features[NB_FEATURES];
     float g[NB_BANDS];
     float gf[FREQ_SIZE];
-- 
2.52.0

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