diff options
author | jan.nijtmans <jan.nijtmans@noemail.net> | 2013-01-03 09:22:04 (GMT) |
---|---|---|
committer | jan.nijtmans <jan.nijtmans@noemail.net> | 2013-01-03 09:22:04 (GMT) |
commit | c67100924580fcbd1cef622d188108125aca231d (patch) | |
tree | 99d1350d9b02e0dce0351536547cc0c340bde3b8 /generic/tclTestObj.c | |
parent | 547272a22bd747655ea975123576ac41f47c4794 (diff) | |
download | tcl-c67100924580fcbd1cef622d188108125aca231d.zip tcl-c67100924580fcbd1cef622d188108125aca231d.tar.gz tcl-c67100924580fcbd1cef622d188108125aca231d.tar.bz2 |
test case for bug-3598580: Tcl_ListObjReplace may release deleted elements too early
FossilOrigin-Name: ee102eb82b03408443298e7f5ebe310fecee2024
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 a55704a..8e9dc93 100644 --- a/generic/tclTestObj.c +++ b/generic/tclTestObj.c @@ -736,6 +736,17 @@ TestobjCmd(clientData, interp, objc, objv) } SetVarToObj(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) { char *typeName; if (objc != 4) { |