[Home]

Summary:ASTERISK-17448: [patch] Segmentation fault in strlen () from /lib64/libc.so.6
Reporter:sybasesql (sybasesql)Labels:
Date Opened:2011-02-21 07:31:59.000-0600Date Closed:2011-05-23 09:41:07
Priority:CriticalRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) backtrace.2011-02-21T12:16:31+0300.txt
( 1) backtrace.2011-02-21T15:49:49+0300.txt
( 2) bug18857.patch
( 3) issue18557_asterisk1.8.3.patch
Description:Dear All!

Today I have two core dump on Asterisk 1.8.2.2 x86_64.
gdb output in attachments.

Comments:By: sybasesql (sybasesql) 2011-02-22 08:04:31.000-0600

I found these lines before core dump:

[Feb 21 12:16:30] WARNING[30172] chan_sip.c: Invalid contact uri  (missing sip: or sips:), attempting to use anyway
[Feb 21 15:49:45] WARNING[1119] chan_sip.c: Invalid contact uri  (missing sip: or sips:), attempting to use anyway

So it's seems like asterisk don't handle properly empty or incorrect contact headers.

By: Leif Madsen (lmadsen) 2011-02-22 10:37:56.000-0600

Please provide unoptimized backtraces.

By: sybasesql (sybasesql) 2011-02-22 10:54:43.000-0600

Unfortunately I do not have unoptimized cores and backtraces.
I will compile new asterisk 1.8.2.4 with don't optimize flags and try reproduce this segmentation fault with my client but not 100% sure of success.

By: oelewapperke (oelewapperke) 2011-04-05 04:25:29

Can someone try this patch ? I'm not sure if it'll work, but it should at least stop the segfault from occurring.

By: Jonathan Rose (jrose) 2011-05-20 14:46:57

It'll stop the crash, but we really shouldn't be sending this function NULL strings in the first place.  What we really need to do is find from the source source where in chan_sip.c the ast_sockaddr_resolve function is being invoked and figure out why it's passing in a null value.

By: Jonathan Rose (jrose) 2011-05-23 09:04:16

sybasesql:  I've submitted a more specific patch to specifically address the bug we are looking at, if you read this, please tell me if you can replicate the issue and if the newly added warning message appears.  Patch is called bug 18857.

By: Digium Subversion (svnbot) 2011-05-23 09:41:00

Repository: asterisk
Revision: 320504

U   branches/1.8/channels/chan_sip.c

------------------------------------------------------------------------
r320504 | jrose | 2011-05-23 09:41:00 -0500 (Mon, 23 May 2011) | 10 lines

Fixes segfault occuring in chan_sip.c at __set_address_from_contact

Checks to see if domain contains anything before sending it off to ast_sockaddr_resolve
which is where the segfault was occuring due to null str.

(closes issue ASTERISK-17448)
Reported by: sybasesql

Review: https://reviewboard.asterisk.org/r/1225/

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=320504

By: Digium Subversion (svnbot) 2011-05-23 09:41:06

Repository: asterisk
Revision: 320505

_U  trunk/
U   trunk/channels/chan_sip.c

------------------------------------------------------------------------
r320505 | jrose | 2011-05-23 09:41:06 -0500 (Mon, 23 May 2011) | 17 lines

Merged revisions 320504 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
 r320504 | jrose | 2011-05-23 09:33:20 -0500 (Mon, 23 May 2011) | 10 lines
 
 Fixes segfault occuring in chan_sip.c at __set_address_from_contact
 
 Checks to see if domain contains anything before sending it off to ast_sockaddr_resolve
 which is where the segfault was occuring due to null str.
 
 (closes issue ASTERISK-17448)
 Reported by: sybasesql
 
 Review: https://reviewboard.asterisk.org/r/1225/
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=320505