diff options
author | jan.nijtmans <jan.nijtmans@noemail.net> | 2013-01-03 09:46:57 (GMT) |
---|---|---|
committer | jan.nijtmans <jan.nijtmans@noemail.net> | 2013-01-03 09:46:57 (GMT) |
commit | 9e0cf6e5a468f0a708f5d6e817b3204fd7c1abcf (patch) | |
tree | 16df47ff0c9462b72d6c4f1a1094e4ed9b149948 /generic/tclTestObj.c | |
parent | 47a216cb1aeba2c3ff9b2f7943b78b2e75ee8e9d (diff) | |
parent | 3e3a798919c86e66fa94f1769d13c5a48dc233d5 (diff) | |
download | tcl-9e0cf6e5a468f0a708f5d6e817b3204fd7c1abcf.zip tcl-9e0cf6e5a468f0a708f5d6e817b3204fd7c1abcf.tar.gz tcl-9e0cf6e5a468f0a708f5d6e817b3204fd7c1abcf.tar.bz2 |
test case for bug-3598580: Tcl_ListObjReplace may release deleted elements too early
FossilOrigin-Name: 6a52542dccb46d851194226f0cfeae401546a777
Diffstat (limited to 'generic/tclTestObj.c')
-rw-r--r-- | generic/tclTestObj.c | 11 |
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; |