Skip to content

Commit 3f96f5c

Browse files
committed
fir.c: Fix buffer overrun when state.len is odd.
1 parent 9829481 commit 3f96f5c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fir.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ struct effect * fir_effect_init_with_filter(const struct effect_info *ei, const
333333
state->filter_frames = filter_frames;
334334
state->len = next_fast_fftw_len(filter_frames);
335335
LOG_FMT(LL_VERBOSE, "%s: info: filter_frames=%zd fft_len=%zd", ei->name, filter_frames, state->len);
336-
state->fr_len = state->len + 2;
336+
state->fr_len = state->len + ((state->len&1)?1:2);
337337
state->tmp_fr = fftw_malloc(state->fr_len * sizeof(fftw_complex));
338338
state->ibuf = calloc(e->ostream.channels, sizeof(sample_t *));
339339
state->obuf = calloc(e->ostream.channels, sizeof(sample_t *));

0 commit comments

Comments
 (0)