Skip to content
Tcl Source Code History Of Ticket ad5a57f2f271b5a4
Login

History Of Ticket ad5a57f2f271b5a4

Artifacts Associated With Ticket ad5a57f2f271b5a4

  1. Ticket change [b2a5196b43] (rid 219331) by chrstphrchvz on 2023-10-12 10:58:29:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/x-fossil-wiki"
    4. comment initialized to:
      The signature of <tt>Tcl_NotifyChannel()</tt> does not match <tt>Tcl_FileProc</tt>, but in core Tcl there are 3 instances where it is passed to <tt>Tcl_CreateFileHandler()</tt> anyway. Example UBSan <tt>-fsanitize=function</tt> error when <tt>Tcl_NotifyChannel()</tt> is later called from <tt>FileHandlerEventProc()</tt>:
      
      <pre>
      <span style="font-weight:bold">tcl/macosx/tclMacOSXNotify.c:1223:6: <span style="color:firebrick">runtime error:</span> call to function Tcl_NotifyChannel through pointer to incorrect function type 'void (*)(void *, int)'
      tclIO.c:8341: <span style="color:gray">note:</span></span> Tcl_NotifyChannel defined here
      SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior tcl/macosx/tclMacOSXNotify.c:1223:6 in 
      </pre>
      
      Since <tt>Tcl_NotifyChannel()</tt> is a public API, the workaround I would propose is to use wrapper functions; see attached patch.
      
      If wanting to pass <tt>Tcl_NotifyChannel</tt> to <tt>Tcl_CreateFileHandler()</tt> is so common elsewhere that it should be allowed, then an alternative would be to add a special case to <tt>FileHandlerEventProc()</tt> which checks if <tt>filePtr-&gt;proc</tt> is <tt>Tcl_NotifyChannel</tt> so that <tt>Tcl_NotifyChannel()</tt> can be called directly.
      
    5. foundin initialized to: "8.6.13"
    6. is_private initialized to: "0"
    7. login: "chrstphrchvz"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "6133eb3026f9b10aa9b7b48da92ae2834fc225b0"
    10. resolution initialized to: "None"
    11. severity initialized to: "Minor"
    12. status initialized to: "Open"
    13. submitter initialized to: "chrstphrchvz"
    14. subsystem initialized to: "01. Notifier"
    15. title initialized to:
      Functions passed to Tcl_CreateFileHandler() must be declared/defined as Tcl_FileProc
      
    16. type initialized to: "Patch"
  2. Add attachment "ad5a57f2f271.diff" [8bb1c45892] (rid 219334) by chrstphrchvz on 2023-10-12 11:01:59.

  3. Ticket change [3f4cce238e] (rid 219362) by jan.nijtmans on 2023-10-12 21:16:11:

    1. assignee changed to: "jan.nijtmans"
    2. closedate changed to: "2460230.38624076"
    3. closer changed to: "jan.nijtmans"
    4. icomment:
      Fixed [428afeec4b77b244|here]
      
      Thanks for the report and the patch!
      
    5. login: "jan.nijtmans"
    6. mimetype: "text/x-fossil-wiki"
    7. resolution changed to: "Fixed"
    8. status changed to: "Closed"