aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2022-11-19 19:33:34 +0100
committerPaul B Mahol <onemda@gmail.com>2022-11-19 19:35:23 +0100
commit34eeb466fbf0bbfd0fc1ef0ffd87155e11ec2261 (patch)
tree3949d88922f71e025c2a69b6642d4d3032e7082d
parent7f3e38bda8c39308dea9d9eb023f4cbe7ed2c671 (diff)
downloadffmpeg-34eeb466fbf0bbfd0fc1ef0ffd87155e11ec2261.tar.gz
avfilter/af_surround: fix possible out of array access
-rw-r--r--libavfilter/af_surround.c5
1 files 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;