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
eb734aab39Fix [7cddd2845c] - crash with >= INT_MAX operands check-in2023-04-29 03:15:116cdc79088dFix for [7cddd2845c] (in progress) check-in2023-04-26 14:56:21
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.