Skip to content
Tcl Source Code Artifact [b2a5196b43]
Login

Artifact [b2a5196b43]

Artifact b2a5196b43f5205f105170b1481b920be3899b03f8d6541d83b74c2beb7b3d64:

Ticket change [b2a5196b43] - New ticket [ad5a57f2f271b5a4|ad5a57f2f2] <i>Functions passed to Tcl_CreateFileHandler() must be declared/defined as Tcl_FileProc</i>. by chrstphrchvz on 2023-10-12 10:58:29.
D 2023-10-12T10:58:29.201
J assignee nobody
J closer nobody
J cmimetype text/x-fossil-wiki
J comment The\ssignature\sof\s<tt>Tcl_NotifyChannel()</tt>\sdoes\snot\smatch\s<tt>Tcl_FileProc</tt>,\sbut\sin\score\sTcl\sthere\sare\s3\sinstances\swhere\sit\sis\spassed\sto\s<tt>Tcl_CreateFileHandler()</tt>\sanyway.\sExample\sUBSan\s<tt>-fsanitize=function</tt>\serror\swhen\s<tt>Tcl_NotifyChannel()</tt>\sis\slater\scalled\sfrom\s<tt>FileHandlerEventProc()</tt>:\r\n\r\n<pre>\r\n<span\sstyle="font-weight:bold">tcl/macosx/tclMacOSXNotify.c:1223:6:\s<span\sstyle="color:firebrick">runtime\serror:</span>\scall\sto\sfunction\sTcl_NotifyChannel\sthrough\spointer\sto\sincorrect\sfunction\stype\s'void\s(*)(void\s*,\sint)'\r\ntclIO.c:8341:\s<span\sstyle="color:gray">note:</span></span>\sTcl_NotifyChannel\sdefined\shere\r\nSUMMARY:\sUndefinedBehaviorSanitizer:\sundefined-behavior\stcl/macosx/tclMacOSXNotify.c:1223:6\sin\s\r\n</pre>\r\n\r\nSince\s<tt>Tcl_NotifyChannel()</tt>\sis\sa\spublic\sAPI,\sthe\sworkaround\sI\swould\spropose\sis\sto\suse\swrapper\sfunctions;\ssee\sattached\spatch.\r\n\r\nIf\swanting\sto\spass\s<tt>Tcl_NotifyChannel</tt>\sto\s<tt>Tcl_CreateFileHandler()</tt>\sis\sso\scommon\selsewhere\sthat\sit\sshould\sbe\sallowed,\sthen\san\salternative\swould\sbe\sto\sadd\sa\sspecial\scase\sto\s<tt>FileHandlerEventProc()</tt>\swhich\schecks\sif\s<tt>filePtr-&gt;proc</tt>\sis\s<tt>Tcl_NotifyChannel</tt>\sso\sthat\s<tt>Tcl_NotifyChannel()</tt>\scan\sbe\scalled\sdirectly.
J foundin 8.6.13
J is_private 0
J login chrstphrchvz
J priority 5\sMedium
J private_contact 6133eb3026f9b10aa9b7b48da92ae2834fc225b0
J resolution None
J severity Minor
J status Open
J submitter chrstphrchvz
J subsystem 01.\sNotifier
J title Functions\spassed\sto\sTcl_CreateFileHandler()\smust\sbe\sdeclared/defined\sas\sTcl_FileProc
J type Patch
K ad5a57f2f271b5a40fe9abef4055dc7b547c80c0
U chrstphrchvz
Z fefc10507a22293845b0065553c7341b