View Ticket
Not logged in
2025-11-14
17:31 Closed ticket [e56486a257]: Improper comparison with TCL_INDEX_NONE to indicate null-terminated strings plus 6 other changes artifact: 7e046e0a3d user: apnadkarni
2025-11-13
17:08
Merge 9.0 - Bug [e56486a2] - check for negative lengths, not equality with TCL_INDEX_NONE check-in: 8c070cca13 user: apnadkarni tags: trunk, main
16:54
Bug [e56486a2] - check for negative lengths, not equality with TCL_INDEX_NONE check-in: aeba91beb2 user: apnadkarni tags: core-9-0-branch
2025-11-12
06:30 New ticket [e56486a257] Improper comparison with TCL_INDEX_NONE to indicate null-terminated strings. artifact: 8e77e0a22e user: apnadkarni

Ticket UUID: e56486a257f75d5f413d52b22b49fa8c428f3806
Title: Improper comparison with TCL_INDEX_NONE to indicate null-terminated strings
Type: Bug Version: 9.0
Submitter: apnadkarni Created on: 2025-11-12 06:30:01
Subsystem: - New Builtin Commands Assigned To: nobody
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2025-11-14 17:31:41
Resolution: Fixed Closed By: apnadkarni
    Closed on: 2025-11-14 17:31:41
Description:
String length parameters to several C functions are documented (in both 8.6  and 9.0) as *If the length is negative, the encoding-specific length of the string is used.*

While 8.6 correctly checked for negative lengths as `(srcLen < 0)`, this has been changed in 9.0 to `(srcLen == TCL_INDEX_NONE)`. Aside from changing the **documented** semantics, this also has resulted in the functions not handling the case of negative values other than -1.

The checks should be reverted back to checking for negative values as opposed to checking for `TCL_INDEX_NONE`.
User Comments: apnadkarni added on 2025-11-14 17:31:41:
Fixed in [aeba91beb2].