From ce6fbd8bb9c3fd5c8a26e3bc71ea22d0679fbd91 Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 12 Apr 2011 20:04:11 +0000 Subject: Repair corruption in [string reverse] when string rep invalidation failed to also reset the bytes allocated for string rep to zero [Bug 3285472]. --- ChangeLog | 6 ++++++ generic/tclStringObj.c | 1 + tests/string.test | 5 +++++ tools/configure | 0 4 files changed, 12 insertions(+) mode change 100755 => 100644 tools/configure diff --git a/ChangeLog b/ChangeLog index dcf2f36..14fb1e4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-04-12 Don Porter + + * generic/tclStringObj.c: Repair corruption in [string reverse] + * tests/string.test: when string rep invalidation failed to also + reset the bytes allocated for string rep to zero [Bug 3285472]. + 2011-04-12 Venkat Iyer * library/tzdata/Atlantic/Stanley: Update to Olson tzdata2011f diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 7437ee4..17bed1b 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2758,6 +2758,7 @@ TclStringObjReverse( source[i++] = tmp; } Tcl_InvalidateStringRep(objPtr); + stringPtr->allocated = 0; return objPtr; } diff --git a/tests/string.test b/tests/string.test index 6b00f3a..cddfe4c 100644 --- a/tests/string.test +++ b/tests/string.test @@ -1608,6 +1608,11 @@ test string-24.11 {string reverse command - corner case} { set y \udead string reverse $x$y } \udead\ubeef +test string-24.12 {string reverse command - corner case} { + set x \ubeef + set y \udead + string is ascii [string reverse $x$y] +} 0 test string-25.1 {string is list} { string is list {a b c} diff --git a/tools/configure b/tools/configure old mode 100755 new mode 100644 -- cgit v0.12