Tcl Source Code

Check-in [6d560f6812]
Login

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

Overview
Comment:[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: 6d560f6812b4e10a19e04776d2df402a8d36a813
User & Date: jan.nijtmans 2012-12-27 14:57:32
Context
2012-12-29
09:16
restore refcounts as they were before the Tcl_ListObjReplace call, in the error situation. In Tcl9, ... check-in: b7ca02496d user: jan.nijtmans tags: core-8-5-branch
2012-12-27
20:54
restore old refcounts in TCL_ERROR case. check-in: d5147fc677 user: jan.nijtmans tags: bug-3598580
15:04
[Bug 3598580]: Tcl_ListObjReplace may release deleted elements too early check-in: 4865e19aac user: jan.nijtmans tags: trunk
14:57
[Bug 3598580]: Tcl_ListObjReplace may release deleted elements too early check-in: 6d560f6812 user: jan.nijtmans tags: core-8-5-branch
14:41
[Bug 3598580]: Tcl_ListObjReplace may release deleted elements too early

Tests!? Where are the t... check-in: a87c1542ff user: jan.nijtmans tags: core-8-4-branch

2012-12-26
09:55
eliminate dependancy of compat/*.h on tcl.h check-in: 5e21e8284c user: jan.nijtmans tags: core-8-5-branch
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ChangeLog.






1
2
3
4
5
6
7





2012-12-21  Jan Nijtmans  <[email protected]>

	* unix/dltest/pkgb.c:  Make pkgb.so loadable in Tcl 8.4 as well.
	* generic/tclStubLib.c: Eliminate unnessarcy static HasStubSupport() and
	isDigit() functions, just do the same inline.

2012-12-13  Jan Nijtmans  <[email protected]>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
2012-12-27  Jan Nijtmans  <[email protected]>

	* generic/tclListObj.c: [Bug 3598580]: Tcl_ListObjReplace may release
	deleted elements too early

2012-12-21  Jan Nijtmans  <[email protected]>

	* unix/dltest/pkgb.c:  Make pkgb.so loadable in Tcl 8.4 as well.
	* generic/tclStubLib.c: Eliminate unnessarcy static HasStubSupport() and
	isDigit() functions, just do the same inline.

2012-12-13  Jan Nijtmans  <[email protected]>

Changes to generic/tclListObj.c.

852
853
854
855
856
857
858




859
860
861
862
863
864
865
	 * overflow in determining 'first+count'
	 */
	count = numElems - first;
    }

    isShared = (listRepPtr->refCount > 1);
    numRequired = numElems - count + objc;





    if ((numRequired <= listRepPtr->maxElemCount) && !isShared) {
	int shift;

	/*
	 * Can use the current List struct. First "delete" count elements
	 * starting at first.







>
>
>
>







852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
	 * overflow in determining 'first+count'
	 */
	count = numElems - first;
    }

    isShared = (listRepPtr->refCount > 1);
    numRequired = numElems - count + objc;

    for (i = 0;  i < objc;  i++) {
	Tcl_IncrRefCount(objv[i]);
    }

    if ((numRequired <= listRepPtr->maxElemCount) && !isShared) {
	int shift;

	/*
	 * Can use the current List struct. First "delete" count elements
	 * starting at first.
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
	    }

	    ckfree((char *) oldListRepPtr);
	}
    }

    /*
     * Insert the new elements into elemPtrs before "first". We don't do a
     * memcpy here because we must increment the reference counts for the
     * added elements, so we must explicitly loop anyway.
     */

    for (i=0,j=first ; i<objc ; i++,j++) {
	elemPtrs[j] = objv[i];
	Tcl_IncrRefCount(objv[i]);
    }

    /*
     * Update the count of elements.
     */

    listRepPtr->elemCount = numRequired;







|
<
<




<







964
965
966
967
968
969
970
971


972
973
974
975

976
977
978
979
980
981
982
	    }

	    ckfree((char *) oldListRepPtr);
	}
    }

    /*
     * Insert the new elements into elemPtrs before "first".


     */

    for (i=0,j=first ; i<objc ; i++,j++) {
	elemPtrs[j] = objv[i];

    }

    /*
     * Update the count of elements.
     */

    listRepPtr->elemCount = numRequired;