Skip to content
Tcl Source Code View Ticket
Login

View Ticket

tailcall crashes with NULL pointer access

Closed / Fixed784befb0baf0c7fda9fd3595ddcec7f56e32749fCreated 4 years agoUpdated 4 years ago
Descriptionmarkdown2023-05-02 15:24:53

The following tailcall results in a crash with a null objPtr in GetNamespaceFromObj in 9.0.

% proc tc args {puts [llength $args]}
% proc p {} [list tailcall tc {*}[lrepeat 254 x]]
% p
-> crash
Referenced by3
apnadkarni Ticket [784befb0ba]: 3 changes [History diff]2023-05-02 15:26:50
apnadkarnimarkdown2023-05-02 15:31:40

In 8.6, the call stack is different, GetNamespaceFromObj does not show up on stack:

>	tcl86t.dll!TclNRTailcallEval(void * * data, Tcl_Interp * interp, int result) Line 8501	C
 	tcl86t.dll!TclNRRunCallbacks(Tcl_Interp * interp, int result, NRE_callback * rootPtr) Line 4503	C
 	tcl86t.dll!TclEvalObjEx(Tcl_Interp * interp, Tcl_Obj * objPtr, int flags, const CmdFrame * invoker, int word) Line 6069	C
 	tcl86t.dll!Tcl_EvalObjEx(Tcl_Interp * interp, Tcl_Obj * objPtr, int flags) Line 6050	C
 	tcl86t.dll!Tcl_RecordAndEvalObj(Tcl_Interp * interp, Tcl_Obj * cmdPtr, int flags) Line 190	C
 	tcl86t.dll!Tcl_MainExW(int argc, wchar_t * * argv, int(*)(Tcl_Interp *) appInitProc, Tcl_Interp * interp) Line 520	C

apnadkarniplain2023-05-02 18:00:37
Fixed for 8.6, 8.7 and 9.0.
Log in (anonymous is fine) to add a comment.