lib/vsprintf: print '?' for illegal Unicode sequence
Commit0e66c10a7d
("lib: vsprintf: avoid overflow printing UTF16 strings") broke the Unicode unit tests: an illegal UTF16 code point should be printed as '?'. Fixes:0e66c10a7d
("lib: vsprintf: avoid overflow printing UTF16 strings") Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
This commit is contained in:
parent
d787caddf1
commit
60c4454ddb
@ -288,6 +288,8 @@ static char *string16(char *buf, char *end, u16 *s, int field_width,
|
|||||||
for (i = 0; i < len && buf + utf16_utf8_strnlen(str, 1) <= end; ++i) {
|
for (i = 0; i < len && buf + utf16_utf8_strnlen(str, 1) <= end; ++i) {
|
||||||
s32 s = utf16_get(&str);
|
s32 s = utf16_get(&str);
|
||||||
|
|
||||||
|
if (s < 0)
|
||||||
|
s = '?';
|
||||||
utf8_put(s, &buf);
|
utf8_put(s, &buf);
|
||||||
}
|
}
|
||||||
for (; len < field_width; --field_width)
|
for (; len < field_width; --field_width)
|
||||||
|
Loading…
Reference in New Issue
Block a user