libluna: Check the whole string in Utf8StringDecoder::code_points()
This commit is contained in:
parent
b4a5aff071
commit
15dcd6ad15
@ -138,9 +138,9 @@ Result<usize> Utf8StringDecoder::code_points() const
|
||||
|
||||
while ((usize)(it - m_str) < m_byte_length)
|
||||
{
|
||||
const usize utf8_len = TRY(utf8_char_length(*it));
|
||||
if ((usize)(it - m_str) + utf8_len > m_byte_length) return err(EILSEQ);
|
||||
it += utf8_len;
|
||||
usize mb_len = m_byte_length - (usize)(it - m_str); // Remaining space
|
||||
TRY(encode_utf8_as_wide_char(it, mb_len));
|
||||
it += mb_len;
|
||||
len++;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user