[asterisk-bugs] [Asterisk 0016667]: [patch] func_math MATH off by one's

Asterisk Bug Tracker noreply at bugs.digium.com
Tue Feb 2 12:54:35 CST 2010


The following issue has been RESOLVED. 
====================================================================== 
https://issues.asterisk.org/view.php?id=16667 
====================================================================== 
Reported By:                wdoekes
Assigned To:                tilghman
====================================================================== 
Project:                    Asterisk
Issue ID:                   16667
Category:                   Functions/func_math
Reproducibility:            always
Severity:                   trivial
Priority:                   normal
Status:                     resolved
Asterisk Version:           SVN 
JIRA:                       SWP-776 
Regression:                 No 
Reviewboard Link:            
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!): 241895 
Request Review:              
Resolution:                 fixed
Fixed in Version:           
====================================================================== 
Date Submitted:             2010-01-21 08:54 CST
Last Modified:              2010-02-02 12:54 CST
====================================================================== 
Summary:                    [patch] func_math MATH off by one's
Description: 
As can be seen from the diff, or the following snippet. MATH contains some
off-by-one's:

Dialplan:

exten => s,n,NoOp(${MATH(170 AND 63,i)} => 42)
exten => s,n,NoOp(${MATH(170AND63,i)} => 42 not 2)

Output:

NoOp("SIP/126680001-0000000c", "42 => 42") in new stack
NoOp("SIP/126680001-0000000c", "2 => 42 not 2") in new stack

This is because in the code, op is shifted +3 and later on +1 again (if
(op) mvalue2 = op+1)


I also removed some unnecessary '\0'-settage and fixed a comment (it's
number2's minuses we're worried about).


Regards,
Walter Doekes
OSSO B.V.

(P.S. I found the bitwise AND I was looking for ;-))
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2010-02-02 12:54 svnbot         Status                   assigned => resolved
2010-02-02 12:54 svnbot         Resolution               open => fixed       
======================================================================




More information about the asterisk-bugs mailing list