Validate runs of non-ASCII bytes with a shift-based UTF-8 DFA (#6180)

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
Niels Lohmann authored and GitHub committed 2026-12-06 14:21:18 +01:00
1 parent 4f29dcf8a0
commit 2271b9cf93
4 files changed
+402 -34

No files matched your search

+4 -3
View File
@@ -206,9 +206,10 @@ places, which differ in speed, diagnostics, and how they read the input:
the bytes as is and leave the check to dump() and the binary writers.
- the per-lead-byte switch in lexer::scan_string(): JSON text, with a
diagnostic for each kind of error.
- validate_one_utf8() and valid_utf8_prefix() in string_scan.hpp: the lexer's
bulk string scan, the bulk path of the BON8 reader, and the BON8 writer.
They must accept exactly what the lexer's switch accepts.
- validate_one_utf8(), utf8_dfa_prefix() and valid_utf8_prefix() in
string_scan.hpp: the lexer's bulk string scan, the bulk path of the BON8
reader, and the BON8 writer. They must accept exactly what the lexer's
switch accepts.
- the byte path of binary_reader::get_bon8_string(): BON8 input without bulk
access, and the bytes the bulk path leaves to it. It keeps its own ranges:
taking them from utf8_shape() made BON8 decoding 2-3% slower (#5891).