Overview
| Artifact ID: | ddd2f1ed3349d900196a6c32f270ef6022a11e7d6353377b4a5ac37f394daab8 |
|---|---|
| Ticket: | abd489a1cf4782f0255f307c42370d3a5e27c464
TclStringCmp() calls functions through pointer to incorrect type |
| User & Date: | chrstphrchvz on 2023-10-13 07:20:01 |
Changes
- assignee changed to: "nobody"
- closer changed to: "nobody"
- cmimetype changed to: "text/x-fossil-wiki"
- comment changed to:
Example UBSan <tt>-fsanitize=function</tt> error: <pre> % string compare a b <span style="font-weight:bold">tcl/generic/tclCmdMZ.c:2863:10: <span style="color:firebrick">runtime error:</span> call to function TclpUtfNcmp2 through pointer to incorrect function type 'int (*)(const void *, const void *, unsigned long)' tclUtf.c:1233: <span style="color:gray">note:</span></span> TclpUtfNcmp2 defined here SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior tcl/generic/tclCmdMZ.c:2863:10 in -1 </pre> Some of the compare functions are public APIs, so I would suggest either using an enum to call functions directly, or wrapper functions (as done by the attached patch).
- foundin changed to: "8.6.13"
- is_private changed to: "0"
- login: "chrstphrchvz"
- priority changed to: "5 Medium"
- private_contact changed to: "6133eb3026f9b10aa9b7b48da92ae2834fc225b0"
- resolution changed to: "None"
- severity changed to: "Minor"
- status changed to: "Open"
- submitter changed to: "chrstphrchvz"
- subsystem changed to: "18. Commands M-Z"
- title changed to:
TclStringCmp() calls functions through pointer to incorrect type
- type changed to: "Patch"