summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tclUtil.c9
-rw-r--r--tests/util.test3
2 files changed, 11 insertions, 1 deletions
diff --git a/generic/tclUtil.c b/generic/tclUtil.c
index d5ec040..bbacbe2 100644
--- a/generic/tclUtil.c
+++ b/generic/tclUtil.c
@@ -2030,7 +2030,14 @@ Tcl_ConcatObj(
continue;
}
if (resPtr) {
- if (TCL_OK != Tcl_ListObjAppendList(NULL, resPtr, objPtr)) {
+ Tcl_Obj *elemPtr = NULL;
+
+ Tcl_ListObjIndex(NULL, objPtr, 0, &elemPtr);
+ if (elemPtr == NULL) {
+ continue;
+ }
+ if (Tcl_GetString(elemPtr)[0] == '#' || TCL_OK
+ != Tcl_ListObjAppendList(NULL, resPtr, objPtr)) {
/* Abandon ship! */
Tcl_DecrRefCount(resPtr);
goto slow;
diff --git a/tests/util.test b/tests/util.test
index f610762..c3b9f2d 100644
--- a/tests/util.test
+++ b/tests/util.test
@@ -215,6 +215,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