Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Error message of "TclGetBytesFromObj" may include arbitrary character

Closed / Fixed165b10396273d81c7bcef3e564537a39eba7404bCreated 5 years agoUpdated 191 days ago
Descriptionwiki2022-03-15 10:50:56
Hi Jan, Don, thank you for your work on propper bytearrays. This is great work.

May I ask for a change? Please make sure, that error messages only contain printable ASCII. You never know, what happens with error messages. They are written to the console, logs or data bases and are set over the network. Thus, arbitrary contents may lead to strange bugs. You never know the encoding of the target.

Here is an example of current main branch, where *TclGetBytesFromObj* is called with the last argument of the following command. *TclGetBytesFromObj* generates this error message:

% encoding convertfrom iso8859-1 \u0141
expected byte sequence but character 0 was 'Ł' (U+000141)

See the "Ł" in the error message. I don't want to imagine what happens, if a non printable character is outputted.

Thank you and take care, Harald

Referenced by1
apnadkarnimarkdown2026-05-25 16:38:24

I agree with Harald. On encoding errors, I don't think we should attempt to print the failing bytes as characters. Question is what the message wording should be. Is the below acceptable to all. It would be nice to agree before changing the strings in the test cases!

% encoding convertfrom iso8859-1 \u0141
expected code point values below 0xff but value at byte offset 0 was 0x141
oehharwiki2026-05-26 08:34:54

Agree Thanks for caring, Harald

apnadkarniplain2026-05-27 03:39:14
Fixed in [fbd094029a]
Log in (anonymous is fine) to add a comment.