[Asterisk-Dev] SIP PA168-based phones calling-in crashes related to division by 0 at __ast_dsp_silence

Mynet Asterisk Dev Team asterisk at mynet.it
Sun Oct 10 12:17:02 MST 2004


After upgrading some cheap PA168 phones to firmware version 1.38, trying
to make a call throught Aterisk from these phones lead to an hardcrash.

After investigating with gdb, I found a division by 0.

This patch:

--- dsp.c~      Wed Mar 24 00:10:35 2004
+++ dsp.c       Sat Oct  9 15:38:45 2004
@@ -1219,7 +1219,7 @@
        accum = 0;
        for (x=0;x<len; x++)
                accum += abs(s[x]);
-       accum /= len;
+       if (len == 0) accum = 0; else accum /= len;
        if (accum < dsp->threshold) {
                dsp->totalsilence += len/8;
                if (dsp->totalnoise) {

cured the problem.

Cheers,
Giovanni

-- 
Mynet Internet Solutions
http://www.mynet.it/





More information about the asterisk-dev mailing list