From 7187e8ecd29717cb711b5e89e1ee3e71afe4d42f Mon Sep 17 00:00:00 2001 From: Chris Rienzo Date: Mon, 15 Apr 2019 19:58:32 +0000 Subject: [PATCH] FS-11785 [libteletone] Fix unlikely divide by zero in teletone_mux_tones --- libs/libteletone/src/libteletone_generate.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libs/libteletone/src/libteletone_generate.c b/libs/libteletone/src/libteletone_generate.c index f052c1fe9e..94ae14d228 100644 --- a/libs/libteletone/src/libteletone_generate.c +++ b/libs/libteletone/src/libteletone_generate.c @@ -256,7 +256,9 @@ TELETONE_API(int) teletone_mux_tones(teletone_generation_session_t *ts, teletone int32_t s = teletone_dds_state_modulate_sample(&tones[i], 0); sample += s; } - sample /= freqlen; + if (freqlen) { + sample /= freqlen; + } ts->buffer[ts->samples] = (teletone_audio_t)sample; for (c = 1; c < ts->channels; c++) {