diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2013-01-03 09:29:18 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2013-01-03 09:29:18 (GMT) |
commit | d27e883b17a58409f62f0aee186b31d850df992d (patch) | |
tree | 9bb9081c4de2c61fb854a5be8219449a5973dba7 /generic/tclTestObj.c | |
parent | 415a324f3cbb26121cb4836b48f68ba5b6b8cf56 (diff) | |
parent | e59a5820dfdb6c77acd3497b07b8236b51bd04d8 (diff) | |
download | tcl-d27e883b17a58409f62f0aee186b31d850df992d.zip tcl-d27e883b17a58409f62f0aee186b31d850df992d.tar.gz tcl-d27e883b17a58409f62f0aee186b31d850df992d.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.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/generic/tclTestObj.c b/generic/tclTestObj.c index 37286e3..8597bbc 100644 --- a/generic/tclTestObj.c +++ b/generic/tclTestObj.c @@ -925,6 +925,17 @@ TestobjCmd( } 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) { |