[asterisk-bugs] [Asterisk 0018060]: [patch] func_string FILTER contains an infinite loop
Asterisk Bug Tracker
noreply at bugs.digium.com
Tue Sep 28 10:57:06 CDT 2010
The following issue has been UPDATED.
======================================================================
https://issues.asterisk.org/view.php?id=18060
======================================================================
Reported By: wdoekes
Assigned To:
======================================================================
Project: Asterisk
Issue ID: 18060
Category: Functions/func_strings
Reproducibility: always
Severity: trivial
Priority: normal
Status: new
Asterisk Version: 1.6.2.13
JIRA:
Regression: No
Reviewboard Link:
SVN Branch (only for SVN checkouts, not tarball releases): N/A
SVN Revision (number only!):
Request Review:
======================================================================
Date Submitted: 2010-09-27 08:41 CDT
Last Modified: 2010-09-28 10:57 CDT
======================================================================
Summary: [patch] func_string FILTER contains an infinite loop
Description:
Hi,
func_strings FILTER() contains an infinite loop when you're using
characters
above \x7f or invalid character escapes (e.g. \xgg).
Dialplan:
Set(var=abc "dëf)
NoOp(var = ${var})
Set(filtered=${FILTER(\x30-\xff,${var})}) ;; no wrapping
NoOp(filtered = ${filtered})
Set(filtered=${FILTER(\x30-\x10,${var})}) ;; wrapping
NoOp(filtered = ${filtered})
Hangup()
Output:
Set("var=abc "dëf") in new stack
NoOp("var = abc "dëf") in new stack
WARNING[21708]: func_strings.c:466 filter: Range wrapping in
FILTER(\x20-\xff,abc "dëf). This may not be what you want.
<-- Infinite loop
Expected output:
Set("var=abc "dëf") in new stack
NoOp("var = abc "dëf") in new stack
Set("filtered=abcdëf") in new stack
NoOp("filtered = abcdëf") in new stack
[2010-09-27 15:25:14] WARNING[23206]: func_strings.c:466 filter: Range
wrapping in FILTER(\x30-\x10,abc "dëf). This may not be what you want.
Set("Local/+31852100586 at osvpi_world-1268;2", "filtered=abcdëf") in new
stack
NoOp("Local/+31852100586 at osvpi_world-1268;2", "filtered = abcdëf") in new
stack
Hangup("") in new stack
I've patched func_strings.c to add a couple of (unsigned char) casts, so
that
ac != c2 is actually false at one point. Otherwise ac loops from 0 to 255
while
c2 is negative.
I've also added a backwards incompatible change of setting c2 to c1 when
a
parse error (invalid character escape) occurs. Otherwise I'd get the
aforementioned warning when using a range that ends at \xff.
Regards,
Walter Doekes
OSSO B.V.
======================================================================
----------------------------------------------------------------------
(0127466) lmadsen (administrator) - 2010-09-28 10:57
https://issues.asterisk.org/view.php?id=18060#c127466
----------------------------------------------------------------------
Update description per your note. Thanks!
Issue History
Date Modified Username Field Change
======================================================================
2010-09-28 10:57 lmadsen Note Added: 0127466
2010-09-28 10:57 lmadsen Description Updated
======================================================================
More information about the asterisk-bugs
mailing list