Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2025-04-16
08:48 • New ticket [03cff7a777] -Wconversion warnings, like TclAdvanceContinuations()</i... artifact: 15b917781d user: jan.nijtmans
2025-02-27
18:39
Remove protections and open branch to work on [27b3ce2997]. leaf check-in: 5285a51808 user: dgp tags: bug-27b3ce2997
2025-02-26
13:56 • Open ticket [27b3ce2997]: Memory access violation in scripts > 2**31 bytes</i... artifact: 4294fc2808 user: dgp
13:54 • Ticket [27b3ce2997]: 4 changes artifact: 7236b26164 user: dgp
13:49 • Ticket [27b3ce2997]: 5 changes artifact: a37c6659aa user: dgp
2023-04-30
10:22 • Closed ticket [27b3ce2997]. artifact: e96d1d0825 user: apnadkarni
10:22 • Ticket [27b3ce2997]: 3 changes artifact: 2cc01c43bb user: apnadkarni
10:20
Fix [27b3ce2997] - check INT_MAX limit on script length check-in: 20ed83cf25 user: apnadkarni tags: trunk, main
2023-04-28
16:57 • Ticket [27b3ce2997] Memory access violation in scripts > 2**31 bytes stat... artifact: 9889d20f9a user: apnadkarni
16:55 • New ticket [27b3ce2997]. artifact: 2969c8bab6 user: apnadkarni

Memory access violation in scripts > 2**31 bytes

Open27b3ce299702ab9a540d16a6f0678b6cd370e5aaCreated 4 years agoUpdated 2 years ago
Descriptionmarkdown2023-04-28 16:55:57

Having a script longer than INT_MAX results in memory access violations even on 64-bit builds. Example is below (invalid set command is intentional)

try [string cat [string repeat " " 0x80000000] "set a b c"]

This is just one example but between the byte code compiler and TIP 280 source code -> source line number tracking there are many occasions for overflowing length limits. Fixing these is non trivial and risky so for the moment the plan is to disallow scripts or byte code sequences longer than INT_MAX.

Marking as minor since not likely to have a such a long script. Scripts in safe interps are still a concern however so protection is still desirable.

Referenced by3
apnadkarni Ticket [27b3ce2997]: 4 changes [History diff]2023-04-28 16:57:03
apnadkarnimarkdown2023-04-30 10:22:05

Fixed in [20ed83cf25]. Generates a Tcl exception now instead of panics or crashes. Allowing for longer scripts is a longer term exercise, 9.1 or may be even later.

apnadkarni Closed ticket [27b3ce2997]. [History diff]2023-04-30 10:22:17
dgpplain2025-02-26 13:49:36
Just taking notice of this.  The limit doesn't merge to dgp-refactor,
and not yet clear if the revisions there are a means of eliminating it.
dgpplain2025-02-26 13:54:26
Quick answer is no, that branch crashes too without protection.
dgpplain2025-02-26 13:56:25
Claiming and re-opening with some interest in examining what
might be done in 9.1
Log in (anonymous is fine) to add a comment.