Merge pull request #306 from dragos-oancea/spandsp-super_tone_rx-div_by_zero

[spandsp] scan-build: Division by zero - test_cadence()
This commit is contained in:
Andrey Volk 2020-02-12 01:00:49 +04:00 committed by GitHub
commit dbceb95b1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -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)