Tcl Source Code

Check-in [93213f3e6d]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:test case for bug-3598580: Tcl_ListObjReplace may release deleted elements too early
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | core-8-5-branch
Files: files | file ages | folders
SHA1: 93213f3e6dd62a035418b53eb98f7d6cb7a6cc35
User & Date: jan.nijtmans 2013-01-03 09:29:18
Context
2013-01-03
14:00
speling ficks check-in: 0087436727 user: dgp tags: core-8-5-branch
11:40
suggested fix for Bug 3092089: [file normalize] can remove path component, and for Bug 3587096: sta... check-in: c74b286bfa user: jan.nijtmans tags: bug-3092089
09:46
test case for bug-3598580: Tcl_ListObjReplace may release deleted elements too early check-in: 6a52542dcc user: jan.nijtmans tags: trunk
09:29
test case for bug-3598580: Tcl_ListObjReplace may release deleted elements too early check-in: 93213f3e6d user: jan.nijtmans tags: core-8-5-branch
09:22
test case for bug-3598580: Tcl_ListObjReplace may release deleted elements too early check-in: ee102eb82b user: jan.nijtmans tags: core-8-4-branch
2013-01-02
19:27
remove stray calls to Tcl_Alloc and friends: the core should only use ckalloc to allow MEM_DEBUG to ... check-in: eac08e625f user: mig tags: core-8-5-branch
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tclTestObj.c.

921
922
923
924
925
926
927











928
929
930
931
932
933
934
	}
	string = Tcl_GetString(objv[3]);
        if (GetVariableIndex(interp, string, &destIndex) != TCL_OK) {
            return TCL_ERROR;
        }
        SetVarToObj(destIndex, varPtr[varIndex]);
	Tcl_SetObjResult(interp, varPtr[destIndex]);











     } else if (strcmp(subCmd, "convert") == 0) {
        char *typeName;
        if (objc != 4) {
            goto wrongNumArgs;
        }
        index = Tcl_GetString(objv[2]);
        if (GetVariableIndex(interp, index, &varIndex) != TCL_OK) {







>
>
>
>
>
>
>
>
>
>
>







921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
	}
	string = Tcl_GetString(objv[3]);
        if (GetVariableIndex(interp, string, &destIndex) != TCL_OK) {
            return TCL_ERROR;
        }
        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) {
            goto wrongNumArgs;
        }
        index = Tcl_GetString(objv[2]);
        if (GetVariableIndex(interp, index, &varIndex) != TCL_OK) {

Changes to tests/listObj.test.

188
189
190
191
192
193
194




195
196
197
198
199
200
201
	    [testlistobj get 1]
    }
    -cleanup {
	testobj freeallvars
    }
    -result {{a b c d e} {} {a b c d e f}}
}





# cleanup
::tcltest::cleanupTests
return

# Local Variables:
# mode: tcl







>
>
>
>







188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
	    [testlistobj get 1]
    }
    -cleanup {
	testobj freeallvars
    }
    -result {{a b c d e} {} {a b c d e f}}
}

test listobj-11.1 {bug 3598580} {
    testobj bug3598580
} 123

# cleanup
::tcltest::cleanupTests
return

# Local Variables:
# mode: tcl