Overview
| Artifact ID: | 744a9173deb23b70c35996b8f55f34394064e9134c7cb77453b03658f12891ed |
|---|---|
| Ticket: | fb368527aeed240f2b345be96119ea66e1fce6fb
String truncation in encoding > 2GB length |
| User & Date: | apnadkarni on 2023-02-26 16:08:04 |
Changes
- icomment:
One more remark on Tcl_UtfToExternal() and Tcl_ExternalToUtf(). It appears you changed the parameter type dstLen and srcLen on those functions from int to Tcl_Size. I don't think that is a good idea. Aside from the fact that it is not TIP'ed (I'm not sure I care much about that aspect, it can be corrected), I think functions should clearly deal with either 32-bit lengths or 64 bit lengths and this should be apparent from their signatures (parameter types). Those two functions have input as Tcl_Size and output (via pointers) as ints. This leads to confusion as to operation when inputs exceed 31-bit lengths. Also, as an aside, although those functions are not widely used within Tcl core, they are public and used by extensions as the Dstring variants do not allow for streaming operations. I'm also diving into the crash on the read side (which is a thornier issue with multiple places where this size_t->int truncation is happening). Another reason to have a clear demarcation between the 64-bit capable and 32-bit capable functions. If the former need to make use of the latter, they need to call them in a loop with appropriate checks on the parameters (as done in this branch) I suggest they be kept as 32-bit length functions, at least for now, since the underlying encoders deal with 32-bit lengths. I'll plan on making that change back. /Ashok
- login: "apnadkarni"
- mimetype: "text/x-markdown"