summaryrefslogtreecommitdiffstats
path: root/generic/tclTestObj.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2013-01-03 09:46:57 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2013-01-03 09:46:57 (GMT)
commit1bef171761a573a3b00543557144bc362439e619 (patch)
tree16df47ff0c9462b72d6c4f1a1094e4ed9b149948 /generic/tclTestObj.c
parentef5aee8d474851119f83e2d2bd0f3b65f8bdae35 (diff)
parenta7affdff053e1ecdf24219ad03a39c70c39d327f (diff)
downloadtcl-1bef171761a573a3b00543557144bc362439e619.zip
tcl-1bef171761a573a3b00543557144bc362439e619.tar.gz
tcl-1bef171761a573a3b00543557144bc362439e619.tar.bz2
test case for bug-3598580: Tcl_ListObjReplace may release deleted elements too early
Diffstat (limited to 'generic/tclTestObj.c')
-rw-r--r--generic/tclTestObj.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/generic/tclTestObj.c b/generic/tclTestObj.c
index 7494beb..4bddc42 100644
--- a/generic/tclTestObj.c
+++ b/generic/tclTestObj.c
@@ -963,6 +963,17 @@ TestobjCmd(
}
SetVarToObj(varPtr, destIndex, varPtr[varIndex]);
Tcl_SetObjResult(interp, varPtr[destIndex]);
+ } else if (strcmp(subCmd, "bug3598580") == 0) {
+ Tcl_Obj *listObjPtr, *elemObjPtr;
+ if (objc != 2) {
+ goto wrongNumArgs;
+ }
+ elemObjPtr = Tcl_NewIntObj(123);
+ listObjPtr = Tcl_NewListObj(1, &elemObjPtr);
+ /* Replace the single list element through itself, nonsense but legal. */
+ Tcl_ListObjReplace(interp, listObjPtr, 0, 1, 1, &elemObjPtr);
+ Tcl_SetObjResult(interp, listObjPtr);
+ return TCL_OK;
} else if (strcmp(subCmd, "convert") == 0) {
const char *typeName;