[Home]

Summary:ASTERISK-15478: [patch] func_math MATH off by one's
Reporter:Walter Doekes (wdoekes)Labels:
Date Opened:2010-01-21 08:54:15.000-0600Date Closed:2010-02-02 12:59:38.000-0600
Priority:TrivialRegression?No
Status:Closed/CompleteComponents:Functions/func_math
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) astsvn-func_match-off-by-one.diff
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 ;-))
Comments:By: Digium Subversion (svnbot) 2010-02-02 12:54:34.000-0600

Repository: asterisk
Revision: 244331

U   trunk/funcs/func_math.c

------------------------------------------------------------------------
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 ASTERISK-15478)
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=244331

By: Digium Subversion (svnbot) 2010-02-02 12:59:21.000-0600

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 ASTERISK-15478)
  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

By: Digium Subversion (svnbot) 2010-02-02 12:59:29.000-0600

Repository: asterisk
Revision: 244333

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

------------------------------------------------------------------------
r244333 | tilghman | 2010-02-02 12:59:29 -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 ASTERISK-15478)
  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=244333

By: Digium Subversion (svnbot) 2010-02-02 12:59:38.000-0600

Repository: asterisk
Revision: 244334

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

------------------------------------------------------------------------
r244334 | tilghman | 2010-02-02 12:59:37 -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 ASTERISK-15478)
  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=244334