Artifacts Associated With Ticket 6e82720e
Ticket change [b11df8219f] (rid 255057) by tomkiti on 2026-07-28 11:56:50:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/x-markdown"
- comment initialized to:
When reading files > 4 GB, Tcl 9 panics with the error "Buffer Underflow, BUFFER_PADDING not enough". I created a 4 GB file on Windows with the command: fsutil file createnew 4294967296.txt 4294967296 The following script crashes on Windows and Linux: set filename 4294967296.txt set chan [open $filename r] read $chan [file size $filename] close $chan A filesize of 4294967295 works. Tcl 8 throws the following error: expected non-negative integer but got "4294967296" while executing "read $chan [file size $filename]" - foundin initialized to: "9.0.4"
- is_private initialized to: "0"
- login: "tomkiti"
- priority initialized to: "5 Medium"
- private_contact initialized to: "1c57e67924247fd7926e89348f266c081ec57db2"
- resolution initialized to: "None"
- severity initialized to: "Critical"
- status initialized to: "Open"
- submitter initialized to: "tomkiti"
- subsystem initialized to: "18. Commands M-Z"
- title initialized to:
Panic "Buffer Underflow, BUFFER_PADDING not enough" when reading files > 4 GB
- type initialized to: "Bug"
Ticket change [89ed737f77] (rid 255058) by tomkiti on 2026-07-28 12:03:20:
- comment changed to:
When reading files >= 4 GB, Tcl 9 panics with the error "Buffer Underflow, BUFFER_PADDING not enough". I created a 4 GB file on Windows with the command: fsutil file createnew 4294967296.txt 4294967296 The following script crashes on Windows and Linux: set filename 4294967296.txt set chan [open $filename r] read $chan [file size $filename] close $chan A filesize of 4294967295 works. Tcl 8 throws the following error: expected non-negative integer but got "4294967296" while executing "read $chan [file size $filename]" - login: "tomkiti"
- mimetype: "text/plain"
- title changed to:
Panic "Buffer Underflow, BUFFER_PADDING not enough" when reading files >= 4 GB
- comment changed to:
Ticket change [744a975337] (rid 255064) by apnadkarni on 2026-07-29 05:55:13:
- icomment:
Does not even need a large file on disk. Appears to be reproducible with 4294967296 size reads on any size file. WIP on branch bug-6e82720e
- login: "apnadkarni"
- mimetype: "text/x-markdown"
- icomment:
Ticket change [585ea97fc3] (rid 255065) by apnadkarni on 2026-07-29 05:55:28:
- assignee changed to: "apnadkarni"
- login: "apnadkarni"
- mimetype: "text/plain"
Ticket change [02e6fe2dab] (rid 255088) by apnadkarni on 2026-08-02 05:48:55:
- icomment:
A related failure mode also shows up in 8.6 ``` % file size x.txt 2 % set fd [open x.txt] file1dd2964bc10 % read $fd 4294967296 % <- empty result. Should return the file content ```
- login: "apnadkarni"
- mimetype: "text/x-markdown"
- icomment:
Ticket change [19241f1e55] (rid 255095) by apnadkarni on 2026-08-02 08:14:10:
- closedate changed to: "2461254.8431728934"
- closer changed to: "apnadkarni"
- icomment:
Fixed for 9.1 in [5a2face9]. No plans to fix for 9.0 as it is dependent on TIP 737 which targets 9.1. A 9.0 fix would require additional changes and not seen as worthwhile for a rare/corner case. Closing accordingly.
- login: "apnadkarni"
- mimetype: "text/x-fossil-plain"
- resolution changed to: "Fixed"
- status changed to: "Closed"