[Home]

Summary:ASTERISK-23220: STACK_PEEK function with no arguments causes crash/core dump
Reporter:James Sharp (jpsharp)Labels:
Date Opened:2014-01-30 02:37:08.000-0600Date Closed:2014-01-31 18:32:01.000-0600
Priority:MajorRegression?
Status:Closed/CompleteComponents:Applications/app_stack
Versions:11.4.0 Frequency of
Occurrence
Frequent
Related
Issues:
Environment:Centos 6.4, amd64Attachments:( 0) ASTERISK-23220.patch
Description:When setting up to use STACK_PEEK, I inadvertently left the arguments out of the dialplan.  When the dialplan reached this point in execution, Asterisk crashed with a core.  I realize that it was my error in the configuration, but I feel the system should flag an error rather than crash in a blaze of core dumps.  If this is a true bug, I can rebuild the system with DONT_OPTIMIZE to get a full backtrack.

The offending dialplan entry is this:
{noformat}
exten => 9998,1,Set(FOO=${STACK_PEEK()})
{noformat}
Comments:By: Corey Farrell (coreyfarrell) 2014-01-30 03:42:09.089-0600

I can confirm this issue exists in all current branches + trunk for functions STACK_PEEK and LOCAL_PEEK.

STACK_PEEK also crashes when called with a single parameter only:
STACK_PEEK(1) will crash
STACK_PEEK(1,) logs an error without crashing.

The attached patch prevents STACK_PEEK and LOCAL_PEEK from crashing due to missing parameters, logging an error instead.

By: Richard Mudgett (rmudgett) 2014-01-31 16:44:54.812-0600

@Corey - Patch looks good to me.  Ship it.