[Home]

Summary:ASTERISK-14567: [patch] crash in LOCAL() if Gosub stack is allocated but empty
Reporter:Ben Winslow (rain)Labels:
Date Opened:2009-07-30 14:45:14Date Closed:2009-08-09 02:13:57
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Applications/app_stack
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) app_stack-read-fix.diff
Description:If the Gosub stack is allocated but empty (e.g. outside of a Gosub, but after a previous call to Gosub on the current channel), local_read() will crash because it blindly dereferences frame = AST_LIST_FIRST(oldlist), which will be NULL.

The attached patch (against trunk) ensures that the stack is not empty in local_read() and deallocates the datastore in return_exec() if the stack is empty.  The latter might not be desirable, but each change is in a separate hunk in the patch should you only want one of them.  The patch applies cleanly against 1.6.x as well.

****** STEPS TO REPRODUCE ******

Execute the minimal dialplan in the 'additional information' field to reproduce.

****** ADDITIONAL INFORMATION ******

[default]
exten => 1234,1,Gosub(gosub_test,s,1)
exten => 1234,n,Verbose(0,LOCAL(crash)=${LOCAL(crash)})
exten => 1234,n,Hangup()

[gosub_test]
exten => s,1,Return()
Comments:By: Digium Subversion (svnbot) 2009-08-09 02:11:43

Repository: asterisk
Revision: 211232

U   trunk/apps/app_stack.c

------------------------------------------------------------------------
r211232 | tilghman | 2009-08-09 02:11:43 -0500 (Sun, 09 Aug 2009) | 4 lines

Check for NULL frame, before dereferencing pointer.
(closes issue ASTERISK-14567)
Reported by: rain

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

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

By: Digium Subversion (svnbot) 2009-08-09 02:12:29

Repository: asterisk
Revision: 211233

_U  branches/1.6.0/
U   branches/1.6.0/apps/app_stack.c

------------------------------------------------------------------------
r211233 | tilghman | 2009-08-09 02:12:29 -0500 (Sun, 09 Aug 2009) | 11 lines

Merged revisions 211232 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

........
 r211232 | tilghman | 2009-08-09 02:11:22 -0500 (Sun, 09 Aug 2009) | 4 lines
 
 Check for NULL frame, before dereferencing pointer.
 (closes issue ASTERISK-14567)
  Reported by: rain
........

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

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

By: Digium Subversion (svnbot) 2009-08-09 02:13:12

Repository: asterisk
Revision: 211234

_U  branches/1.6.1/
U   branches/1.6.1/apps/app_stack.c

------------------------------------------------------------------------
r211234 | tilghman | 2009-08-09 02:13:12 -0500 (Sun, 09 Aug 2009) | 11 lines

Merged revisions 211232 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

........
 r211232 | tilghman | 2009-08-09 02:11:22 -0500 (Sun, 09 Aug 2009) | 4 lines
 
 Check for NULL frame, before dereferencing pointer.
 (closes issue ASTERISK-14567)
  Reported by: rain
........

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

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

By: Digium Subversion (svnbot) 2009-08-09 02:13:56

Repository: asterisk
Revision: 211235

_U  branches/1.6.2/
U   branches/1.6.2/apps/app_stack.c

------------------------------------------------------------------------
r211235 | tilghman | 2009-08-09 02:13:56 -0500 (Sun, 09 Aug 2009) | 11 lines

Merged revisions 211232 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

........
 r211232 | tilghman | 2009-08-09 02:11:22 -0500 (Sun, 09 Aug 2009) | 4 lines
 
 Check for NULL frame, before dereferencing pointer.
 (closes issue ASTERISK-14567)
  Reported by: rain
........

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

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