Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2003-07-12
06:52 • Closed ticket [769902ffff]: string trimright depends on Tcl_UtfPrev bug pl... artifact: 0a1edd17cd user: dgp
2003-07-11
21:55 • New ticket [769902ffff]. artifact: a18d741368 user: dgp

[string trimright] depends on Tcl_UtfPrev bug

Closed / Invalid769902ffffffffffffffffffffffffffffffffffCreated 23 years agoUpdated 23 years ago
Descriptionplain2003-07-11 21:55:21
Line 2318 of revision 1.82.2.5 of generic/tclCmdMZ.c
calls Tcl_UtfPrev().  On the first pass through the
loop, the first argument is actually a pointer to one
byte past the end of the stringrep.  Tcl_UtfPrev()
is documented to accept a "pointer to some location
in  a  UTF-8  string".

Currently this is safe, but if Tcl_UtfPrev() is ever
changed to match its documentation
(see Tcl Bug 769895), there may be trouble here.
dgpplain2003-07-12 06:52:24
Logged In: YES 
user_id=80530


sorry. pilot error.

The string comes from a prior
Tcl_GetStringFromObj(), and
such a string must be null-terminated.
"one past the end" would be that NULL.
If it is not, it's because some extension
did not follow the Tcl_RegisterObjType
docs, and the bug is there, not here.
Log in (anonymous is fine) to add a comment.