From: Andrey Volk Date: Tue, 31 May 2022 21:09:48 +0000 (+0300) Subject: [Core] VAD: Add a math sanity check to the switch_vad_process X-Git-Tag: v1.10.12^2~36^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=85400015b7eed420f49bfde85cd08acc44f48b28;p=thirdparty%2Ffreeswitch.git [Core] VAD: Add a math sanity check to the switch_vad_process --- diff --git a/src/switch_vad.c b/src/switch_vad.c index 6118c0237e..74d131331b 100644 --- a/src/switch_vad.c +++ b/src/switch_vad.c @@ -206,7 +206,9 @@ SWITCH_DECLARE(switch_vad_state_t) switch_vad_process(switch_vad_t *vad, int16_t j += vad->channels; } - score = (uint32_t) (energy / (samples / vad->divisor)); + if (samples && vad->divisor && samples >= vad->divisor) { + score = (uint32_t)(energy / (samples / vad->divisor)); + } #ifdef SWITCH_HAVE_FVAD } #endif