Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Memory access crash if more than INT_MAX operands to an uncompiled command

Closed / Fixed7cddd2845cab04ddeb4d735df0643eb8637a4739Created 4 years agoUpdated 4 years ago
Descriptionmarkdown2023-04-13 15:03:55

The {*} expansion works (or seems to) for large lists when the script is compiled. Uncompiled scripts result in invalid memory access and a crash.

% set l [list {*}[testbigdata list 0x7fffffff]]; llength $l
2147483647 -> works
% unset l
% set list list
list
% set l [$list {*}[testbigdata list 0x7fffffff]]; llength $l
...crash...

Number of arguments supported is limited to MAX_INT (I think) but (a) it is curious that the compiled version works but not uncompiled, and (b) rather than invalid memory, a Tcl exception should be raised or if that is not possible, a controlled Tcl_Panic rather than writes to random memory.

Referenced by2
apnadkarniplain2023-04-26 14:53:41
The issue is not with the list command specifically but with > INT_MAX operands to any uncompiled command.
apnadkarniplain2023-04-29 03:18:39
Fixed in [eb734aab39]. Now raises Tcl exception.
Log in (anonymous is fine) to add a comment.