|
2024-08-22
| ||
| 19:10 | Merge [70a45a970d918453], "Fix [ad5a57f2f2]: Functions passed to Tcl_CreateFileHandler() must be dec... check-in: 34c055c567 user: pooryorick tags: unchained, INCOMPATIBLE_LICENSE | |
|
2023-10-12
| ||
| 21:16 | • Closed ticket [ad5a57f2f2]: Functions passed to Tcl_CreateFileHandler() must be ... artifact: 3f4cce238e user: jan.nijtmans | |
| 15:11 | Fix [ad5a57f2f2]: Functions passed to Tcl_CreateFileHandler() must be declared/defined as Tcl_FilePr... check-in: 428afeec4b user: jan.nijtmans tags: core-8-6-branch | |
| 11:01 | • Add attachment ad5a57f2f271.diff to ticket [ad5a57f2f271b5a4|ad5a57f2f2... artifact: 8bb1c45892 user: chrstphrchvz | |
| 10:58 | • New ticket [ad5a57f2f2] Functions passed to Tcl_CreateFileHandler() must be decl... artifact: b2a5196b43 user: chrstphrchvz | |
Functions passed to Tcl_CreateFileHandler() must be declared/defined as Tcl_FileProc
Closed / Fixedad5a57f2f271b5a40fe9abef4055dc7b547c80c0Created 3 years agoUpdated 3 years ago
Descriptionwiki2023-10-12 10:58:29
The signature of Tcl_NotifyChannel() does not match Tcl_FileProc, but in core Tcl there are 3 instances where it is passed to Tcl_CreateFileHandler() anyway. Example UBSan -fsanitize=function error when Tcl_NotifyChannel() is later called from FileHandlerEventProc():
tcl/macosx/tclMacOSXNotify.c:1223:6: runtime error: call to function Tcl_NotifyChannel through pointer to incorrect function type 'void (*)(void *, int)'
tclIO.c:8341: note: Tcl_NotifyChannel defined here
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior tcl/macosx/tclMacOSXNotify.c:1223:6 in
Since Tcl_NotifyChannel() is a public API, the workaround I would propose is to use wrapper functions; see attached patch.
If wanting to pass Tcl_NotifyChannel to Tcl_CreateFileHandler() is so common elsewhere that it should be allowed, then an alternative would be to add a special case to FileHandlerEventProc() which checks if filePtr->proc is Tcl_NotifyChannel so that Tcl_NotifyChannel() can be called directly.
Referenced by2
34c055c567Merge [70a45a970d918453], "Fix [ad5a57f2f2]: Functions passed to Tcl_CreateFileHandler() must be declared/defined as Tcl_FileProc. Also, add some type-casts" and "Those type-casts don't work well in C++". check-in2024-08-22 19:10:05428afeec4bFix [ad5a57f2f2]: Functions passed to Tcl_CreateFileHandler() must be declared/defined as Tcl_FileProc. Also, add some type-casts check-in2023-10-12 15:11:10
jan.nijtmanswiki2023-10-12 21:16:11
Fixed [here]
Thanks for the report and the patch!
Log in (anonymous is fine) to add a comment.
Attachments:
- ad5a57f2f271.diff [download] added by chrstphrchvz on 2023-10-12 11:01:59. [details]