[Home]

Summary:ASTERISK-26570: Macro allows an infinite loop of dialplan inclusion resulting in a crash
Reporter:Tzafrir Cohen (tzafrir)Labels:
Date Opened:2016-11-09 10:15:19.000-0600Date Closed:2018-05-09 11:28:37
Priority:MinorRegression?
Status:Closed/CompleteComponents:Applications/app_macro
Versions:11.22.0 14.1.1 Frequency of
Occurrence
Related
Issues:
Environment:Note: not tested with 14. Instead, tested with a fairly recent master (bf01ff53f8d93d637981720331405e56f0b3b118), on both my Debian Testing laptoop and a Centos 6 server.Attachments:( 0) backtrace.txt
Description:When app_macro considers the dialplan extension to execute, it loops through contexts and fails to protect from an infinite loop. The result may be a crash with over 5700 recursive calls to find_matching_priority() called from macro_exec().

Reproduce: An Asterisk system with the following dialplan:
{code}
[test]
include => test2
; A simplistic recursive scan never gets here
include => test1

exten => macro,1,Answer()
same => n,Macro(test)
same => n,Hangup()

[test2]
include => test

[test1]
exten => s,1,NoOp(Starting Macro)

[macro-test]
include => test
{code}

Now call the macro. E.g.:
{code}
channel originate Local/macro@test Application Wait 40
{code}
Comments:By: Asterisk Team (asteriskteam) 2016-11-09 10:15:20.627-0600

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

By: Rusty Newton (rnewton) 2016-11-10 16:29:05.204-0600

Attaching a huge backtrace for what it is worth.

By: Friendly Automation (friendly-automation) 2018-05-09 11:28:38.126-0500

Change 8931 merged by Jenkins2:
app_macro: Prevent infinite loop in find_matching_priority.

[https://gerrit.asterisk.org/8931|https://gerrit.asterisk.org/8931]

By: Friendly Automation (friendly-automation) 2018-05-09 11:33:26.105-0500

Change 8929 merged by Jenkins2:
app_macro: Prevent infinite loop in find_matching_priority.

[https://gerrit.asterisk.org/8929|https://gerrit.asterisk.org/8929]

By: Friendly Automation (friendly-automation) 2018-05-09 11:34:20.754-0500

Change 8930 merged by Jenkins2:
app_macro: Prevent infinite loop in find_matching_priority.

[https://gerrit.asterisk.org/8930|https://gerrit.asterisk.org/8930]