Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2025-11-14
17:31 • Closed ticket [e56486a257]: Improper comparison with TCL_INDEX_NONE to indicate ... 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... artifact: 8e77e0a22e user: apnadkarni

Improper comparison with TCL_INDEX_NONE to indicate null-terminated strings

Closed / Fixede56486a257f75d5f413d52b22b49fa8c428f3806Created 1 year agoUpdated 1 year ago
Descriptionmarkdown2025-11-12 06:30:01

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.

apnadkarniplain2025-11-14 17:31:41
Fixed in [aeba91beb2].
Log in (anonymous is fine) to add a comment.