| Ticket UUID: | ad9361fd20f0b9c5c94d67f3c2b0450005d27250 | |||
| Title: | string end-relative calculation broken for large indices | |||
| Type: | Bug | Version: | 9.0 | |
| Submitter: | apnadkarni | Created on: | 2023-03-24 18:58:04 | |
| Subsystem: | 18. Commands M-Z | Assigned To: | apnadkarni | |
| Priority: | 5 Medium | Severity: | Important | |
| Status: | Closed | Last Modified: | 2023-05-01 12:19:00 | |
| Resolution: | Fixed | Closed By: | apnadkarni | |
| Closed on: | 2023-05-01 12:19:00 | |||
| Description: |
``` % string range [string insert [string repeat a 0x80000000] end-0x7fffffff X] 0 10 Xaaaaaaaaaa ``` I expected "aXaaa..." Along the same lines, ``` % set s [string repeat a 0xffffffff]; string length $s 4294967295 % string index $s end-0xfffffffe a % string range $s end-0xfffffffe end-0xfffffffe <- (empty string) ``` `string index` gives correct result but not `string range`. | |||
| User Comments: |
apnadkarni added on 2023-05-01 12:19:00:
Fixed somewhere in the TIP 660 commits. Added tests in [ed26748c6b] apnadkarni added on 2023-03-25 10:45:45: Along the same lines, ``` % string length [string range $s end-0x7fffffff end-0x7ffffffe] 2147483664 % string length [string range $s end-0x7ffffffd end-0x7ffffffd] 1 ``` So the breakage seems to occur right at end-INT_MAX. I don't understand TclEncodeIndex well enough to tell if the bug is there or in the caller (range command) /Ashok | |||