Tcl Source Code

Check-in [ee102eb82b]
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-4-branch
Files: files | file ages | folders
SHA1: ee102eb82b03408443298e7f5ebe310fecee2024
User & Date: jan.nijtmans 2013-01-03 09:22:04
Context
2013-01-05
00:28
adjust stub library version number check-in: 8130a7f17b user: jan.nijtmans tags: core-8-4-branch
2013-01-03
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
14:18
Don't free ctrl.script if thread creation fails: it is a constant string "testthread wait" normally. check-in: 6bcdf3eabe user: jan.nijtmans tags: core-8-4-branch
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tclTestObj.c.

732
733
734
735
736
737
738











739
740
741
742
743
744
745
	}
	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) {







>
>
>
>
>
>
>
>
>
>
>







732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
	}
	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.

176
177
178
179
180
181
182




183
184
185
186
187
188
189
test listobj-8.1 {SetListFromAny} {
    lindex {0 foo\x00help 2} 1
} "foo\x00help"

test listobj-9.1 {UpdateStringOfList} {
    string length [list foo\x00help]
} 8





# cleanup
::tcltest::cleanupTests
return










>
>
>
>







176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
test listobj-8.1 {SetListFromAny} {
    lindex {0 foo\x00help 2} 1
} "foo\x00help"

test listobj-9.1 {UpdateStringOfList} {
    string length [list foo\x00help]
} 8

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

# cleanup
::tcltest::cleanupTests
return