Artifacts Associated With Ticket 218905ffffffffff
Ticket change [cceb47b58b] (rid 95792) by nobody on 2000-10-26 01:07:37:
- assignee initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized to:
OriginalBugID: 2623 Bug Version: 8.2 SubmitDate: '1999-08-31' LastModified: '1999-11-18' Severity: CRIT Status: Released Submitter: techsupp ChangedBy: hobbs OS: Windows NT Machine: X86 FixedDate: '1999-11-18' FixedInVersion: 8.2.1 ClosedDate: '2000-10-25' Name: Matt Newman CustomShell: The above patch, plus the tclPosixStr.c patch plus a patch to fix the -translation and -eofchar bugs in GetOption code (to be submitted sortly) Comments: A low risk patch that urgently needs to be applied. ObservedBehavior: Tcl_ReadChars does not allocate a Tcl_Obj for its data, but instead uses the existing Tcl Result OBJ. This is normally relatively safe, but bad practice. How ever with stacked channels the underlying channel may issue Tcl_Eval's during the read processing, which causes a complex corruption of the Tcl_Obj that Tcl_ReadChars is using - and because of the way it works this almost *ALWAYS* will cause a core dump. This behaviour was first observed whilst testing the shortly-to-be-released TLS (aka SSL) extension - but the exposure exists for *ALL* stacked channels that may perform Tcl_Evals. DesiredBehavior: No bugs - no crashs. Patch: Index: tclIOCmd.c =================================================================== RCS file: /cvs/tcl/tcl8.2/generic/tclIOCmd.c,v retrieving revision 1.1.1.1 diff -c -r1.1.1.1 tclIOCmd.c *** tclIOCmd.c 1999/08/19 12:32:00 1.1.1.1 --- tclIOCmd.c 1999/08/23 16:59:41 *************** *** 350,361 **** } } ! resultPtr = Tcl_GetObjResult(interp); charactersRead = Tcl_ReadChars(chan, resultPtr, toRead, 0); if (charactersRead < 0) { Tcl_ResetResult(interp); Tcl_AppendResult(interp, "error reading \"", name, "\": ", Tcl_PosixError(interp), (char *) NULL); return TCL_ERROR; } --- 350,363 ---- } } ! resultPtr = Tcl_NewObj(); ! Tcl_IncrRefCount(resultPtr); charactersRead = Tcl_ReadChars(chan, resultPtr, toRead, 0); if (charactersRead < 0) { Tcl_ResetResult(interp); Tcl_AppendResult(interp, "error reading \"", name, "\": ", Tcl_PosixError(interp), (char *) NULL); + Tcl_DecrRefCount(resultPtr); return TCL_ERROR; } *************** *** 372,377 **** --- 374,381 ---- Tcl_SetObjLength(resultPtr, length - 1); } } + Tcl_SetObjResult(interp, resultPtr); + Tcl_DecrRefCount(resultPtr); return TCL_OK; } PatchFiles: generic/tclIOCmd.c in 8.2.1 -- 11/18/1999 hobbs - foundin initialized to: "obsolete: 8.2"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "nobody"
- subsystem initialized to: "62. (unused)"
- title initialized to: "Tcl_ReadChars is unsafe for stacked channels"
- type initialized to: "Bug"
Ticket change [05000e9982] (rid 88974) by welch on 2000-10-26 08:31:15:
- closedate changed to: "2000-10-26T01:31:15"
- closer changed to: "welch"
- priority changed to: "2"
- resolution changed to: "Fixed"
- status changed to: "Closed"
Ticket change [e03ec01922] (rid 115152) by dgp on 2001-04-03 06:31:21:
- closedate changed to: "2001-04-02T23:31:21"
- closer changed to: "dgp"
- subsystem changed to: "25. Channel System"