Artifacts Associated With Ticket 1675116fffffffff
Ticket change [749c362286] (rid 105232) by dgp on 2007-03-06 17:23:35:
- assignee initialized to: "dkf"
- cmimetype initialized to: "text/plain"
- comment initialized to:
Following script crashes: set l {1 2 3} proc compare args { string length $::l } lsort -command compare $l - foundin initialized to: "None"
- is_private initialized to: "0"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "dgp"
- subsystem initialized to: "17. Commands I-L"
- title initialized to: "lsort crash"
- type initialized to: "Bug"
Ticket change [81b470b86e] (rid 117086) by afredd on 2007-03-08 00:54:44:
- icomment:
Logged In: YES user_id=1386588 Originator: NO Here's a fix. It simply does a Tcl_DuplicateObj of the input list and sorts that (but only for calls using -command since this is the only way to hit the problem). [PS try doing the given example using -indices. No crash, but some odd looking indexes!] --- tclCmdIL.c-orig2007-03-07 17:42:32.856819800 +0000 +++ tclCmdIL.c2007-03-07 17:47:05.580806000 +0000 @@ -4143,7 +4143,7 @@ int i, index, unique, indices; Tcl_Obj *resultPtr; int length; - Tcl_Obj *cmdPtr, **listObjPtrs; + Tcl_Obj *cmdPtr, *listPtr, **listObjPtrs; SortElement *elementArray; SortElement *elementPtr; SortInfo sortInfo;/* Information about this sort that needs to @@ -4302,9 +4302,14 @@ } Tcl_ListObjAppendElement(interp, newCommandPtr, Tcl_NewObj()); sortInfo.compareCmdPtr = newCommandPtr; +/* Fixes [SW#1675116] */ +listPtr = Tcl_DuplicateObj(objv[objc-1]); +Tcl_IncrRefCount(listPtr); + } else { +listPtr = objv[objc-1]; } - sortInfo.resultCode = Tcl_ListObjGetElements(interp, objv[objc-1], + sortInfo.resultCode = Tcl_ListObjGetElements(interp, listPtr, &length, &listObjPtrs); if (sortInfo.resultCode != TCL_OK || length <= 0) { goto done; @@ -4353,6 +4358,7 @@ done: if (sortInfo.sortMode == SORTMODE_COMMAND) { Tcl_DecrRefCount(sortInfo.compareCmdPtr); +Tcl_DecrRefCount(listPtr); sortInfo.compareCmdPtr = NULL; } if (sortInfo.indexc > 1) { - login: "afredd"
- mimetype: "text/plain"
- username: "afredd"
- icomment:
Ticket change [501311b99f] (rid 125915) by dkf on 2007-03-08 06:04:10:
- priority changed to: "9 Immediate"
Ticket change [e31305e5ab] (rid 87726) by dkf on 2007-03-09 23:41:06:
- foundin changed to: "obsolete: 8.4.14"
- icomment:
Logged In: YES user_id=79902 Originator: NO Fixed in HEAD. Needs backport.
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
Ticket change [ea71868ed3] (rid 103383) by dkf on 2007-03-10 21:58:20:
- closedate changed to: "2007-03-10T14:58:20"
- closer changed to: "dkf"
- icomment:
Logged In: YES user_id=79902 Originator: NO Fixed in 8.4 branch.
- login: "dkf"
- mimetype: "text/plain"
- resolution changed to: "Fixed"
- status changed to: "Closed"
- username: "dkf"