From ba2416c126de67f6372cc293ccb2feb633d235f9 Mon Sep 17 00:00:00 2001 From: EmperorBale Date: Thu, 14 Jul 2022 19:40:33 -0700 Subject: [PATCH] core: Multibyte codepoints cannot be in ascii range --- wstr/src/utils.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wstr/src/utils.rs b/wstr/src/utils.rs index 367a72c53..eba451996 100644 --- a/wstr/src/utils.rs +++ b/wstr/src/utils.rs @@ -147,7 +147,10 @@ impl<'a> Iterator for AvmUtf8Decoder<'a> { ch <<= 6; ch |= (*b & (u8::MAX >> 2)) as u32; } - if !fail { + if ch <= 128 { + self.index += 1; + ch = first as u32; + } else if !fail { self.index += mb_count as usize + 1; } }