[PATCH 2/4] strings: skip invalid UTF-8 encodings
Jan Beulich
jbeulich@suse.com
Fri Nov 7 10:24:12 GMT 2025
On 25.09.2025 20:08, Alice Carlotti wrote:
> Add more rigorous checks to is_valid_utf8. Previously we would
> incorrectly accept:
> - overlong encodings
> - out of range encodings (greater than 0x10ffff)
> - UTF-16 surrogate pair encoding values
> - 4 byte encodings with bit pattern 0b11111... in the leading byte
>
> Since this requires computing the codepoint, save it in an out parameter
> so that the callers can pass it in to display_utf8_char.
>
> Additionally, change the escape sequence format for 4-byte encodings
> from \uxxxxxx to \Uxxxxxxxx.
And we have no testcase at all that would require adjustment following this
change?
In any event, okay with a similar adjustment as requested for patch 1.
Jan
More information about the Binutils
mailing list