<i>Do not pass incompatible function pointers to Tcl_EventuallyFree()</i> status still Open with 3 other changes
by
.
D 2023-10-11T07:23:35.746
J icomment Jan,\sI\sam\ssorry\sif\sthe\stitle\sI\sgave\sthis\sticket\swas\smisleading,\sbut\sunfortunately\sthe\swork\sso\sfar\son\sthe\sbug-8ab8a138c9\sbranch\sultimately\sdoes\snot\ssolve\sthe\sproblem.\r\n\r\nWhat\smatters\sis\sthe\stype\sof\sactual\sfunction\sdeclarations/definitions,\sand\snot\sthe\stype\sof\sfunction\spointers\spassed\sto\s<tt>Tcl_EventuallyFree()</tt>.\r\n\r\nAt\sruntime,\swhen\s<tt>freeProc()</tt>\sis\scalled\sfrom\s<tt>Tcl_EventuallyFree()</tt>\sor\s<tt>Tcl_Release()</tt>,\sUBSan\s<tt>-fsanitize=function</tt>\schecks\swhether\sthe\sfunction\spointed\sto\sby\s<tt>freeProc</tt>\swas\sactually\sdeclared/defined\swith\sa\ssignature\smatching\sthe\stype\sof\s<tt>freeProc</tt>,\swhich\sis\s<tt>Tcl_FreeProc</tt>.\sIt\sdoes\snot\smatter\sto\sthis\sUBSan\scheck\swhether\sthe\sfunction\spointer\sin\s<tt>freeProc</tt>\swas\soriginally\spassed\sto\s<tt>Tcl_EventuallyFree()</tt>\sthrough\sany\scasts,\sso\sI\sdo\snot\ssee\swhat\sis\saccomplished\sby\sadditional\sintermediate\scasting\sthrough\s<tt>void\s*</tt>.\r\n\r\nI\sstill\sbelieve\sthe\scorrect\sfix\sfor\sthis\sproblem\sis\sto\sdeclare/define\sfunctions\scorrectly,\swhich\sis\swhat\sI\smeant\sin\sthe\stitle:\sonly\spointers\sto\sfunctions\swhose\sactual\sdeclarations/definitions\smatch\s<tt>Tcl_FreeProc</tt>\sshould\sbe\spassed\sto\s<tt>Tcl_EventuallyFree()</tt>\s(which\scan\sbe\sdone\swithout\scasts),\sso\sthat\sUBSan\sdoes\snot\scomplain\swhen\sthe\sfunction\sis\slater\scalled\sfrom\s<tt>Tcl_EventuallyFree()</tt>\sor\s<tt>Tcl_Release()</tt>.
J login chrstphrchvz
J mimetype text/x-fossil-wiki
K 8ab8a138c9156e5a5a4a386310c6fd11608b8805
U chrstphrchvz
Z 0a320baade0333b686733d76aca8de6d