Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2023-04-29
03:18 • Closed ticket [7cddd2845c]: Memory access crash if more than INT_MAX operands to... artifact: 6eca3d181e user: apnadkarni
03:15
Fix [7cddd2845c] - crash with >= INT_MAX operands check-in: eb734aab39 user: apnadkarni tags: trunk, main
2023-04-26
14:56
Fix for [7cddd2845c] (in progress) check-in: 6cdc79088d user: apnadkarni tags: bug-7cddd2845c
14:53 • Ticket [7cddd2845c] Memory access crash if more than INT_MAX operands to an unco... artifact: 2e72ad68ed user: apnadkarni
2023-04-13
15:03 • New ticket [7cddd2845c]. artifact: 8bf2356acd user: apnadkarni

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.