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

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


A NOTE has been added to this issue. 
====================================================================== 
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:                     closed
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:59 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 ;-))
====================================================================== 

---------------------------------------------------------------------- 
 (0117543) svnbot (reporter) - 2010-02-02 12:59
 https://issues.asterisk.org/view.php?id=16667#c117543 
---------------------------------------------------------------------- 
Repository: asterisk
Revision: 244332

_U  branches/1.6.0/
U   branches/1.6.0/funcs/func_math.c

------------------------------------------------------------------------
r244332 | tilghman | 2010-02-02 12:59:20 -0600 (Tue, 02 Feb 2010) | 16
lines

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

........
  r244331 | tilghman | 2010-02-02 12:54:33 -0600 (Tue, 02 Feb 2010) | 9
lines
  
  Correct some off-by-one errors, especially when expressions don't
contain expected spaces.
  
  Also include the tests provided by the reporter, as regression tests.
  
  (closes issue https://issues.asterisk.org/view.php?id=16667)
   Reported by: wdoekes
   Patches: 
         astsvn-func_match-off-by-one.diff uploaded by wdoekes (license
717)
........

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

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

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2010-02-02 12:59 svnbot         Note Added: 0117543                          
======================================================================




More information about the asterisk-bugs mailing list