diff options
author | Dario Lombardo <lomato@gmail.com> | 2016-09-22 12:03:07 +0300 |
---|---|---|
committer | Tristan Matthews <tmatth@videolan.org> | 2016-09-22 15:55:51 +0300 |
commit | 76c944d24ba07c7a19725f951acb1d481546e1e3 (patch) | |
tree | 1001a3bda3de19968922d2e5d40d47ebd002688b | |
parent | bc82a5341e5437d27557ba9244f7f2100b0ad7e1 (diff) |
codecs/speex: add checks in speex_resampler_init_frac/set_rate_frac.
Add checks to avoid den_rate and num_rate to be set to 0.
Change-Id: Ia4880521e7ab73d0fdc44377f4badadb09365471
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Signed-off-by: Dario Lombardo <lomato@gmail.com>
Signed-off-by: Tristan Matthews <tmatth@videolan.org>
-rw-r--r-- | libspeexdsp/resample.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libspeexdsp/resample.c b/libspeexdsp/resample.c index aadf685..9fbb5dd 100644 --- a/libspeexdsp/resample.c +++ b/libspeexdsp/resample.c @@ -802,7 +802,7 @@ EXPORT SpeexResamplerState *speex_resampler_init_frac(spx_uint32_t nb_channels, SpeexResamplerState *st; int filter_err; - if (quality > 10 || quality < 0) + if (nb_channels == 0 || ratio_num == 0 || ratio_den == 0 || quality > 10 || quality < 0) { if (err) *err = RESAMPLER_ERR_INVALID_ARG; @@ -1111,6 +1111,10 @@ EXPORT int speex_resampler_set_rate_frac(SpeexResamplerState *st, spx_uint32_t r spx_uint32_t fact; spx_uint32_t old_den; spx_uint32_t i; + + if (ratio_num == 0 || ratio_den == 0) + return RESAMPLER_ERR_INVALID_ARG; + if (st->in_rate == in_rate && st->out_rate == out_rate && st->num_rate == ratio_num && st->den_rate == ratio_den) return RESAMPLER_ERR_SUCCESS; |