#2405 [string trimright] depends on Tcl_UtfPrev bug

obsolete: 8.4.3
closed-invalid
5
2003-07-11
2003-07-11
Don Porter
No

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.

Discussion

  • Don Porter

    Don Porter - 2003-07-11

    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.

     
  • Don Porter

    Don Porter - 2003-07-11
    • assigned_to: dkf --> dgp
    • status: open --> closed-invalid