Re: Undefined behavior in utf8_decode()

"'Scott Morgan' via lua-l" <[email protected]>
Newsgroups gmane.comp.lang.lua.general
Message-ID <[email protected]>
On 16/02/2026 15:05, Sergey Bronnikov wrote:
>
> make MYCFLAGS=-fsanitize=undefined MYLDFLAGS=-fsanitize=undefined
> echo "dXRmOC5sZW4n2b0B/4+Pj4+Pj48AACc=" | base64 --decode | ./lua -
> 

d9 bd 01 ff 8f 8f 8f 8f 8f 8f 8f 00 00

That doesn't appear to be valid UTF8 (0xff shouldn't appear in UTF8 
bytes[1])

May be an argument about whether the utf8 lib should detect invalid 
strings, or if it's the users job to sanitise before use.

Scott

[1] https://www.rfc-editor.org/rfc/rfc3629#page-3
 > The octet values C0, C1, F5 to FF never appear

-- 
You received this message because you are subscribed to the Google Groups "lua-l" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/lua-l/c7be98a7-5fce-4a5c-b1cd-c5d4ae044e20%40blueyonder.co.uk.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.