Summary: | ASTERISK-02238: SIGFPE causes asterisk to crash (i4l) | ||
Reporter: | pm (pm) | Labels: | |
Date Opened: | 2004-08-19 11:04:53 | Date Closed: | 2008-01-15 15:05:23.000-0600 |
Priority: | Critical | Regression? | No |
Status: | Closed/Complete | Components: | Core/General |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ||
Description: | When using Asterisk with the modem channel driver (i4l), and a HFC card, it sometimes crashes with SIGFPE. This happens quite often. Seen on a Fedora Core 2.0 with kernel 2.4.7 with the CVS HEAD version of Asterisk. But I had also SIGFPE's with the RC2 version. ****** ADDITIONAL INFORMATION ****** I tracked the problem down. The reason for the SIGFPE is a division by zero in dsp.c:1235 accum /= len; The following patch works perfectly for me: --- ../asterisk-v-1_0_RC2/dsp.c 2004-07-24 23:06:54.000000000 +0200 +++ dsp.c 2004-08-18 10:11:26.017124954 +0200 @@ -1229,6 +1229,13 @@ int x; int res = 0; + /*PM BEGIN*/ + if (len==0) { + ast_log(LOG_WARNING, "zero length packet\n"); + return 0; + } + /*PM END*/ + accum = 0; for (x=0;x<len; x++) accum += abs(s[x]); This is a typical stack trace: | #0 0x080a3178 in __ast_dsp_silence (dsp=0x9eb6980, s=0x9e2593c, len=0, | totalsilence=0x0) at dsp.c:1235 | #1 0x080a12ec in ast_dsp_process (chan=0x9e75ab8, dsp=0x9eb6980, | af=0x9e258cc) at dsp.c:1468 | #2 0x00b89ade in i4l_read (p=0x9e257c0) at chan_modem_i4l.c:451 | #3 0x008f59fb in modem_read (ast=0x0) at chan_modem.c:484 | #4 0x0805b1fa in ast_read (chan=0x9e75ab8) at channel.c:1277 | ASTERISK-1 0x0805c809 in ast_readstring (c=0x9e75ab8, s=0x4b74b40 "1", len=79, | timeout=2000, ftimeout=10000, enders=0x35762a "#") at channel.c:1080 | ASTERISK-2 0x0034b9ba in vm_execmain (chan=0x9e75ab8, data=0x4f) at | app_voicemail.c:3573 | ASTERISK-3 0x080727ff in pbx_exec (c=0x9e75ab8, app=0x9e755b8, data=0x4b77810, | newstack=1) at pbx.c:467 | ASTERISK-4 0x0807a6f3 in pbx_extension_helper (c=0x9e75ab8, context=0x9e75c10 | "incoming", exten=0x9e75d04 "8500", priority=2, callerid=0x9e9b7e0 | "69911590527", action=135059155) at pbx.c:1271 | ASTERISK-5 0x08074798 in ast_pbx_run (c=0x9e75ab8) at pbx.c:1752 | ASTERISK-6 0x0807ad21 in pbx_thread (data=0x0) at pbx.c:1971 | ASTERISK-7 0x00d7198c in start_thread () from /lib/tls/libpthread.so.0 | ASTERISK-8 0x00cbd16a in clone () from /lib/tls/libc.so.6 | ||
Comments: | By: Digium Subversion (svnbot) 2008-01-15 15:05:23.000-0600 Repository: asterisk Revision: 3626 U trunk/dsp.c ------------------------------------------------------------------------ r3626 | markster | 2008-01-15 15:05:22 -0600 (Tue, 15 Jan 2008) | 2 lines Fix divide by zero (bugs ASTERISK-2238 and 2259) ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=3626 |