Fix utf-8 parsing issue in the parser (#19666)

This commit is contained in:
pfg
2025-05-14 22:14:55 -07:00
committed by GitHub
parent a7b46ebbfe
commit df8ad0cf0b

View File

@@ -3820,6 +3820,9 @@ pub inline fn decodeWTF8RuneTMultibyte(p: *const [4]u8, len: u3_fast, comptime T
}
const s3 = p[3];
if ((s3 & 0xC0) != 0x80) return zero;
{
const cp = (@as(T, p[0] & 0x07) << 18) | (@as(T, s1 & 0x3F) << 12) | (@as(T, s2 & 0x3F) << 6) | (@as(T, s3 & 0x3F));
if (cp < 0x10000 or cp > 0x10FFFF) return zero;