[FFmpeg-cvslog] avfilter/af_surround: fix possible out of array access

Paul B Mahol git at videolan.org
Sat Nov 19 20:33:11 EET 2022


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sat Nov 19 19:33:34 2022 +0100| [34eeb466fbf0bbfd0fc1ef0ffd87155e11ec2261] | committer: Paul B Mahol

avfilter/af_surround: fix possible out of array access

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=34eeb466fbf0bbfd0fc1ef0ffd87155e11ec2261
---

 libavfilter/af_surround.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/libavfilter/af_surround.c b/libavfilter/af_surround.c
index 13efc4f7ed..702fdc624a 100644
--- a/libavfilter/af_surround.c
+++ b/libavfilter/af_surround.c
@@ -388,13 +388,12 @@ static inline void get_lfe(int output_lfe, int n, float lowcut, float highcut,
         dst[2 * n    ] = mag * cosf(ph);  \
         dst[2 * n + 1] = mag * sinf(ph);
 
-
 static void calculate_factors(AVFilterContext *ctx, int ch, int chan)
 {
     AudioSurroundContext *s = ctx->priv;
     float *factor = (float *)s->factors->extended_data[ch];
-    const float f_x = s->f_x[sc_map[chan]];
-    const float f_y = s->f_y[sc_map[chan]];
+    const float f_x = s->f_x[sc_map[chan >= 0 ? chan : 0]];
+    const float f_y = s->f_y[sc_map[chan >= 0 ? chan : 0]];
     const int rdft_size = s->rdft_size;
     const float *x = s->x_pos;
     const float *y = s->y_pos;



More information about the ffmpeg-cvslog mailing list