Ticket UUID: | 1901113 | |||
Title: | Crash in tcl::Bgerror | |||
Type: | Bug | Version: | obsolete: 8.5.2 | |
Submitter: | tallniel | Created on: | 2008-02-25 02:26:43 | |
Subsystem: | 02. Event Loops | Assigned To: | dgp | |
Priority: | 9 Immediate | Severity: | ||
Status: | Closed | Last Modified: | 2008-03-11 00:53:05 | |
Resolution: | Fixed | Closed By: | dgp | |
Closed on: | 2008-03-10 17:53:05 | |||
Description: |
The current ::tcl::Bgerror command crashes (Bus error/coredump) on Mac OS X 10.4.11 when called with empty arguments: % info pa 8.5.2b1 % parray tcl_platform tcl_platform(byteOrder) = littleEndian tcl_platform(machine) = i386 tcl_platform(os) = Darwin tcl_platform(osVersion) = 8.11.1 tcl_platform(platform) = unix tcl_platform(pointerSize) = 4 tcl_platform(threaded) = 1 tcl_platform(user) = nem tcl_platform(wordSize) = 4 % interp bgerror {} ::tcl::Bgerror % tcl::Bgerror {} {} Bus error | |||
User Comments: |
dgp added on 2008-03-11 00:53:05:
Logged In: YES user_id=80530 Originator: NO fixed for 8.5.2 dgp added on 2008-03-11 00:49:54: File Added - 269843: 1901113.patch Logged In: YES user_id=80530 Originator: NO Attached path implementing that alternative fix; includes tests. File Added: 1901113.patch dgp added on 2008-02-26 04:55:57: Logged In: YES user_id=80530 Originator: NO thanks for catching this. crashing is bad; this needs fixing. I think the right fix, though, is to raise an error back to the caller if required entries of the return options dict are not set. tallniel added on 2008-02-25 09:51:24: File Added - 267826: bgerror.patch Logged In: YES user_id=102050 Originator: YES Looks like TclDefaultBgErrorHandlerObjCmd (in generic/tclEvent.c) doesn't check for error conditions when retrieving options from the dictionary. Notably, if the dictionary passed in doesn't contain either of the expected keys {-level, -code} then the code will crash as it attempts to access the NULL pointer returned from Tcl_DictObjGet. (The code is safe for -errorcode and -errorinfo). I attach a patch to fix this bug, by assuming -level 0 and -code TCL_ERROR (which seem like reasonable defaults). Obviously, this command is unlikely to be called directly like this anyway, but it's a simple fix to avoid a crash condition. Also assigning to dgp as ChangeLog has your name against last entry for this command. Cheers, Neil File Added: bgerror.patch |