diff options
author | dgp <dgp@noemail.net> | 2011-07-19 19:31:31 (GMT) |
---|---|---|
committer | dgp <dgp@noemail.net> | 2011-07-19 19:31:31 (GMT) |
commit | 92e5225f3e58dced78ebcc4ae27b317fc763197b (patch) | |
tree | 94cd602dcf7621440e6a3ecbe365cb755ee368d3 | |
parent | 53534fd72419b1f2f15398a9da87f588f54137ac (diff) | |
parent | e96834e02b7fa5eb046e0ba43634ab80cbce6a97 (diff) | |
download | tcl-92e5225f3e58dced78ebcc4ae27b317fc763197b.zip tcl-92e5225f3e58dced78ebcc4ae27b317fc763197b.tar.gz tcl-92e5225f3e58dced78ebcc4ae27b317fc763197b.tar.bz2 |
3371644 Repair failure to properly handle (length == -1) in TclConvertElement().
FossilOrigin-Name: 8e355308497b5beaf86055f64460cab0ce21e988
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | generic/tclUtil.c | 4 | ||||
-rw-r--r-- | tests/util.test | 8 |
3 files changed, 12 insertions, 6 deletions
@@ -1,6 +1,8 @@ -2011-07-19 Alexandre Ferrieux <ferrieux@users.sourceforge.net> +2011-07-19 Don Porter <dgp@users.sourceforge.net> - * generic/tclUtil.c: Fix [bug 3371644] -- crash on Tcl_ConvertElement with leading pound. + * generic/tclUtil.c: [Bug 3371644] Repair failure to properly handle + * tests/util.test: (length == -1) scanning in TclConvertElement(). + Thanks to Thomas Sader and Alexandre Ferrieux. 2011-07-19 Donal K. Fellows <dkf@users.sf.net> diff --git a/generic/tclUtil.c b/generic/tclUtil.c index 55103e3..51508d2 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -1261,9 +1261,7 @@ int TclConvertElement( p[1] = '#'; p += 2; src++; - if (length > 0) { - length--; - } + length -= (length > 0); } else { conversion = CONVERT_BRACE; } diff --git a/tests/util.test b/tests/util.test index d06925b..15457da 100644 --- a/tests/util.test +++ b/tests/util.test @@ -175,6 +175,12 @@ test util-3.5.1 {Tcl_ConverCountedElement procedure - quote leading '#'} { rename #\{ {} set result } {#} +test util-3.6 {Tcl_ConvertElement, Bug 3371644} { + interp create #\\ + interp alias {} x #\\ concat + interp target {} x ;# Crash if bug not fixed + interp delete #\\ +} {} test util-4.1 {Tcl_ConcatObj - backslash-space at end of argument} { concat a {b\ } c @@ -3895,4 +3901,4 @@ return # Local Variables: # mode: tcl -# End: +# End:
\ No newline at end of file |