[Home]

Summary:ASTERISK-06642: Missing default 'default' case for switches
Reporter:Luke-Jr (luke-jr)Labels:
Date Opened:2006-03-28 16:38:27.000-0600Date Closed:2011-06-07 14:07:23
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/NewFeature
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:If you omit the 'default' case in a switch and none of the cases specified match, the call falls through instead of continuing as expected.
Comments:By: Luke-Jr (luke-jr) 2006-03-28 23:06:22.000-0600

Fixing instructions (not a patch, as that would be 'GPL-only, no disclaimer' coming from me):

First, move the first two lines of the 'break' code (567-569; these determine the Goto location for a break) after the main extension's switch code (after the 'Finish switch-...' NoOP it goes to is added-- around line 532), obviously with a variable name other than 'tmp' ;)
Once that is done, simply update the 'break' code to use that variable instead of remaking it every time.
After the switch's while-loop (which really should be a for-loop!), if 'curcase' is still set (an unterminated case) then do the same as the 'break' code for adding the final extension to it, that way it won't drop the call in that circumstance (eg, 'default: ... }<end-of-switch>;').
Finally, in any case, add a '_sw-%d-.' extension at priority 1 that does the same Goto trick. If the 'default' case is already specified, Asterisk should ignore this second addition and thus it will only have effect when there is no specified default.

By: Serge Vecher (serge-v) 2006-05-03 12:14:13

Luke-Jr: please try the revamped AEL code in latest trunk and report if the problem still exist there ...

By: Luke-Jr (luke-jr) 2006-05-03 14:20:21

Will do, once it is released. I don't run Svn code.

By: Serge Vecher (serge-v) 2006-05-03 14:36:24

Thanks for replying. Closing this issue with instructions in the archive for those who need them. Thanks.