Patch for missing error check in TclGetDefaultStdChannel on
Closed / Fixed218453ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 01:00:34
OriginalBugID: 581 Bug Version: 8.1a2 SubmitDate: '1998-05-21' LastModified: '1998-11-19' Severity: SER Status: Released Submitter: hershey ChangedBy: rjohnson OS: All OSVersion: NA Machine: NA FixedDate: '1998-11-19' FixedInVersion: 8.0.5 ClosedDate: '2000-10-25' In Tcl 8.1a2, on Windows, the function TclGetDefaultStdChannel, in win/tclWinChan.c, does not check the return value of Tcl_MakeFileChannel before passing it to Tcl_SetChannelOption. However, it is possible, if somewhat unlikely, for Tcl_MakeFileChannel to fail, when there is some confusion over handles and the mode in which they were opened. It is better to return an indication of failure than to get a segmentation violation. I have appended the obvious patch. Ian Taylor [email protected] *** tclWinChan.c.~1~ Fri Apr 10 17:47:12 1998 --- tclWinChan.c Fri Apr 10 17:47:17 1998 *************** TclpGetDefaultStdChannel(type) *** 1180,1185 **** --- 1180,1188 ---- } channel = Tcl_MakeFileChannel(handle, mode); + if (channel == NULL) { + return NULL; + } /* * Set up the normal channel options for stdio handles. This bug also appeared in Tcl 8.0. I fixed it in version 8.0.5. The change will propagate up to 8.1. - Ray
welch Closed ticket [218453ffff].
[History diff]2000-10-26 08:22:16
dgp Ticket [218453ffff]: 3 changes
[History diff]2001-04-17 04:23:41
Log in (anonymous is fine) to add a comment.