From 7ad87515adbcc27b025ddb728d4ae8c99f3a58c2 Mon Sep 17 00:00:00 2001 From: HedgehogInTheCPP Date: Sat, 19 Sep 2026 23:14:01 +0300 Subject: [PATCH] I'm not sure why plus here should be ignored. But OK. Biodegradable test code: auto answer = fast_float::parse_number_string( f.data(), f.data() + f.size(), fast_float::parse_options( fast_float::chars_format::json | fast_float::chars_format::allow_leading_plus)); // should be ignored if (!answer.invalid) { std::cerr << "json parse accepted invalid json " << f << std::endl; return EXIT_FAILURE; } --- include/fast_float/ascii_number.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/fast_float/ascii_number.h b/include/fast_float/ascii_number.h index bf2de63..1c362be 100644 --- a/include/fast_float/ascii_number.h +++ b/include/fast_float/ascii_number.h @@ -528,7 +528,8 @@ parse_number_string(UC const *p, UC const *pend, // C++17 20.19.3.(7.1) explicitly forbids '+' sign here answer.negative = *p == UC('-'); if (answer.negative || - (chars_format_t(options.format & chars_format::allow_leading_plus) && + (!json_fmt && + chars_format_t(options.format & chars_format::allow_leading_plus) && *p == UC('+'))) { ++p;