[Home]

Summary:ASTERISK-18392: Segmentation fault on Caller ID pattern matching when Caller ID is empty
Reporter:Ales Zelenik (aleszelenik)Labels:
Date Opened:2011-08-31 08:03:41Date Closed:2011-11-11 09:27:15.000-0600
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Core/PBX
Versions:1.8.6.0 Frequency of
Occurrence
Constant
Related
Issues:
is duplicated byASTERISK-18560 Crash while executing macro with CALLERID(num) is empty
Environment:Debian 5.0, gcc version 4.3.2 (Debian 4.3.2-1.1)Attachments:( 0) extension_matching_segfault.patch
Description:Segmentation fault occurs on pattern matching, presumably when there is no Caller ID. Happens on 1.8.6.0-rc3, possibly also in previous versions. Can provide core on demand.

Backtrace:
#0  0xb76aab53 in strcasecmp () from /lib/i686/cmov/libc.so.6
#1  0x0813fb21 in _extension_match_core (pattern=0xf6144b6 "_385.", data=0x0, mode=E_MATCH) at pbx.c:2331
#2  0x0813fe93 in extension_match_core (pattern=0xf6144b6 "_385.", data=0x0, mode=E_MATCH) at pbx.c:2494
#3  0x0813fed0 in ast_extension_match (pattern=0xf6144b6 "_385.", data=0x0) at pbx.c:2501
#4  0xb6a7d5a7 in find_matching_priority (c=0xf6114e8, exten=0x97901b8 "s", priority=1, callerid=0x0) at app_macro.c:199
#5  0xb6a7e51a in _macro_exec (chan=0x978fdf0, data=0xb3dfcd48 "fix-cidnum", exclusive=0) at app_macro.c:396
#6  0xb6a7f967 in macro_exec (chan=0x978fdf0, data=0xb3dfcd48 "fix-cidnum") at app_macro.c:586
#7  0x0813c628 in pbx_exec (c=0x978fdf0, app=0xb4578dd0, data=0xb3dfcd48 "fix-cidnum") at pbx.c:1422
#8  0x08145a57 in pbx_extension_helper (c=0x978fdf0, con=0x0, context=0x9790168 "macro-fix-cidnum", exten=0x97901b8 "s", priority=2, label=0x0, callerid=0x0,
   action=E_SPAWN, found=0xb3dff258, combined_find_spawn=1) at pbx.c:4120
#9  0x081478c4 in ast_spawn_extension (c=0x978fdf0, context=0x9790168 "macro-fix-cidnum", exten=0x97901b8 "s", priority=2, callerid=0x0, found=0xb3dff258,
   combined_find_spawn=1) at pbx.c:4745
#10 0x08148285 in __ast_pbx_run (c=0x978fdf0, args=0x0) at pbx.c:4843
#11 0x08149e30 in pbx_thread (data=0x978fdf0) at pbx.c:5178
#12 0x0819c146 in dummy_start (data=0xf5572e0) at utils.c:1004
#13 0xb74e24c0 in start_thread () from /lib/i686/cmov/libpthread.so.0
#14 0xb771384e in clone () from /lib/i686/cmov/libc.so.6


Dialplan:
[from-pri]
...
exten => _X.,n,Macro(fix-cidnum)
...

[macro-fix-cidnum]
exten => s/anonymous,1,NoOp(anonymous)
exten => s/_385.,1,Set(CALLERID(num)=000${CALLERID(num)})
exten => s/_386.,1,Set(CALLERID(num)=000${CALLERID(num)})
exten => s/_390.,1,Set(CALLERID(num)=000${CALLERID(num)})
exten => s/_43.,1,Set(CALLERID(num)=000${CALLERID(num)})
exten => s/_49.,1,Set(CALLERID(num)=000${CALLERID(num)})
exten => s/_0.,1,NoOp(0)
exten => s,1,Set(CALLERID(num)=00${CALLERID(num)})
Comments:By: Leif Madsen (lmadsen) 2011-09-15 09:05:04.894-0500

Looks like we have a couple of these open now. I've marked them as duplicates because it seems to be in the same code area (whatever part does the CID pattern matching)

By: Jonathan Rose (jrose) 2011-09-29 08:54:39.537-0500

I think this patch has it covered.  My setup was a little different from this one, so could you try it out for me and tell me your results?

By: Jonathan Rose (jrose) 2011-10-24 13:44:41.092-0500

Please test the patch posted to the issue.

By: Ales Zelenik (aleszelenik) 2011-11-10 03:52:01.804-0600

Tested, behavior looks fixed.

thank you!