Overview
| Artifact ID: | 625ed48733deab2cdfd3641bd9b24804da793a3748c5a5106ecc3c6088896ee8 |
|---|---|
| Ticket: | fb368527aeed240f2b345be96119ea66e1fce6fb
String truncation in encoding > 2GB length |
| User & Date: | apnadkarni on 2023-02-24 18:00:21 |
Changes
- assignee changed to: "nobody"
- closer changed to: "nobody"
- cmimetype changed to: "text/x-markdown"
- comment changed to:
As of commit [ba4e192f46] ``` % string length [set s [string repeat A 4100000000]] 4100000000 % string length [encoding convertto ascii $s] 0 ``` The issue is that `Tcl_UtfToExternalDString[Ex]` and `Tcl_ExternalToUtfDString[Ex]` functions take `srcLen` as `Tcl_Size` but pass it down to the underlying encoders as parameters of `int` type resulting in silent truncation or sign flipping of the value. In the above example, the length is treated as treated as negative resulting in an immediate return of 0. If the value was greater than 4G, it would simply return a shortened string. I am a bit surprised the compiler does not complain about this.
- foundin changed to: "9.0"
- is_private changed to: "0"
- login: "apnadkarni"
- priority changed to: "5 Medium"
- private_contact changed to: "9546e9877f1a8899e25a89082561ee694e7fb402"
- resolution changed to: "None"
- severity changed to: "Important"
- status changed to: "Open"
- submitter changed to: "apnadkarni"
- subsystem changed to: "16. Commands A-H"
- title changed to: "String truncation in encoding > 2GB length"
- type changed to: "Bug"