mirror of
https://github.com/nlohmann/json.git
synced 2026-09-30 06:14:59 +01:00
Pinning the bytes around the invalid one to 0x80 lost coverage: with error_handler_t::ignore/replace, the serializer re-reads the invalid byte and decodes the following bytes, and its decoder distinguishes the continuation classes 0x80-0x8F, 0x90-0x9F, and 0xA0-0xBF, as do the lexer's range checks. Iterate those positions over the first and last byte of each class within the valid range instead (utils::utf8_continuation_bytes). The invalid byte still takes all 256 values. Defining JSON_TEST_UTF8_EXHAUSTIVE restores the full Cartesian product, with the same assertion counts as before #5418. Signed-off-by: Niels Lohmann <mail@nlohmann.me>