From 1525a24c2618a2106d70efd538270d6888b9239d Mon Sep 17 00:00:00 2001 From: Dragos Oancea Date: Tue, 4 Feb 2020 14:22:57 +0000 Subject: [PATCH] [spandsp] scan-build: Division by zero - test_cadence() --- libs/spandsp/src/super_tone_rx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/spandsp/src/super_tone_rx.c b/libs/spandsp/src/super_tone_rx.c index a6324f91bf..2d54361da1 100644 --- a/libs/spandsp/src/super_tone_rx.c +++ b/libs/spandsp/src/super_tone_rx.c @@ -170,7 +170,8 @@ static int test_cadence(super_tone_rx_segment_t *pattern, return 0; } } - j = (rotation + steps - 1)%steps; + if (steps) + j = (rotation + steps - 1)%steps; if (pattern[j].f1 != test[9].f1 || pattern[j].f2 != test[9].f2) return 0; if (pattern[j].max_duration < test[9].min_duration*SUPER_TONE_BINS)