From 32a76688f63ce4b8af7a8c1e6ef82444cd549f7f Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 14 Apr 2021 18:23:07 +0000 Subject: Test demonstrating bug [26649439c7]. --- tests/util.test | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/util.test b/tests/util.test index 3f7ffe2..9eee1a6 100644 --- a/tests/util.test +++ b/tests/util.test @@ -206,6 +206,9 @@ test util-4.7 {Tcl_ConcatObj - refCount safety} testconcatobj { # symptoms was Bug #2055782. testconcatobj } {} +test util-4.8 {Tcl_ConcatObj - [Bug 26649439c7]} { + concat [list foo] [list #] +} {foo {#}} proc Wrapper_Tcl_StringMatch {pattern string} { # Forces use of Tcl_StringMatch, not Tcl_UniCharCaseMatch -- cgit v0.12 From bf055cc0d8bd85fe77feac05766fe8b5dea46a87 Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 14 Apr 2021 18:37:35 +0000 Subject: Bug fix --- generic/tclUtil.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/generic/tclUtil.c b/generic/tclUtil.c index d7e0168..086b03b 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -1859,7 +1859,8 @@ Tcl_ConcatObj( TclListObjGetElements(NULL, objPtr, &listc, &listv); if (listc) { if (resPtr) { - if (TCL_OK != Tcl_ListObjReplace(NULL, resPtr, + if (Tcl_GetString(listv[0])[0] == '#' + || TCL_OK != Tcl_ListObjReplace(NULL, resPtr, INT_MAX, 0, listc, listv)) { /* Abandon ship! */ Tcl_DecrRefCount(resPtr); -- cgit v0.12