Skip to content

Commit 8c078a6

Browse files
committed
utf8ByteSequenceLength: reject lead bytes > 0xF4
UTF-8 start bytes in the range [0xF5 .. 0xFF] are disallowed as they would encode code points above U+10FFFF
1 parent b6e1a10 commit 8c078a6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/std/unicode.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub fn utf8ByteSequenceLength(first_byte: u8) !u3 {
3131
0b0000_0000...0b0111_1111 => 1,
3232
0b1100_0000...0b1101_1111 => 2,
3333
0b1110_0000...0b1110_1111 => 3,
34-
0b1111_0000...0b1111_0111 => 4,
34+
0b1111_0000...0b1111_0100 => 4,
3535
else => error.Utf8InvalidStartByte,
3636
};
3737
}

0 commit comments

Comments
 (0)