diff options
author | Dario Lombardo <lomato@gmail.com> | 2016-08-08 22:10:48 +0200 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2016-08-19 11:23:37 +0000 |
commit | 3a7e3057e6aeade67d7fc3bbc89614f5a26e93d1 (patch) | |
tree | e0314bee6d38acf8d50f308035a6f5267035ddf9 /codecs | |
parent | c3a8a0ce8ad391bda135fe39f304cc23e3025101 (diff) |
codecs/speex: add check in speex_resampler_init_frac/set_rate_frac (CID 1355648).
Add checks to avoid den_rate and num_rate to be set to 0.
Change-Id: Ia4880521e7ab73d0fdc44377f4badadb09365471
Reviewed-on: https://code.wireshark.org/review/16963
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'codecs')
-rw-r--r-- | codecs/speex/resample.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/codecs/speex/resample.c b/codecs/speex/resample.c index 88f29749b2..4a0e53deb1 100644 --- a/codecs/speex/resample.c +++ b/codecs/speex/resample.c @@ -788,7 +788,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; @@ -1076,6 +1076,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; |