Mercurial > libavcodec.hg
changeset 11944:052b9c58ccc4 libavcodec
Remove VLA in ff_kbd_window_init, limit window size to 1024
author | mru |
---|---|
date | Thu, 24 Jun 2010 09:42:34 +0000 |
parents | 3f5b35e5f4de |
children | 1acf2841dc5f |
files | fft.h mdct.c |
diffstat | 2 files changed, 9 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/fft.h Thu Jun 24 09:02:44 2010 +0000 +++ b/fft.h Thu Jun 24 09:42:34 2010 +0000 @@ -151,10 +151,15 @@ } /** + * Maximum window size for ff_kbd_window_init. + */ +#define FF_KBD_WINDOW_MAX 1024 + +/** * Generate a Kaiser-Bessel Derived Window. * @param window pointer to half window * @param alpha determines window shape - * @param n size of half window + * @param n size of half window, max FF_KBD_WINDOW_MAX */ void ff_kbd_window_init(float *window, float alpha, int n);
--- a/mdct.c Thu Jun 24 09:02:44 2010 +0000 +++ b/mdct.c Thu Jun 24 09:42:34 2010 +0000 @@ -36,9 +36,11 @@ { int i, j; double sum = 0.0, bessel, tmp; - double local_window[n]; + double local_window[FF_KBD_WINDOW_MAX]; double alpha2 = (alpha * M_PI / n) * (alpha * M_PI / n); + assert(n <= FF_KBD_WINDOW_MAX); + for (i = 0; i < n; i++) { tmp = i * (n - i) * alpha2; bessel = 1.0;