Re: \U expansion in single-byte locale

2023-05-29 Thread Chet Ramey
On 5/26/23 3:44 AM, Grisha Levit wrote: If expanding a \u (or \U) escape sequence fails, Bash replaces the input escape sequence with a newly generated one: $ LC_ALL=C printf %b \\U80 \u0080 Bash normalizes to a consistent result across printf/echo/$''. Since this new sequence may by longer

\U expansion in single-byte locale

2023-05-26 Thread Grisha Levit
If expanding a \u (or \U) escape sequence fails, Bash replaces the input escape sequence with a newly generated one: $ LC_ALL=C printf %b \\U80 \u0080 Since this new sequence may by longer than the input, it can cause an overflow in printf: $ bash-asan -c 'LC_ALL=C printf %b \\U80' ERROR: Addres