mirror of
https://github.com/fastfloat/fast_float.git
synced 2026-10-28 18:07:16 +08:00
I'm not sure why plus here should be ignored. But OK. Biodegradable test code:
auto answer = fast_float::parse_number_string<true>(
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;
}
This commit is contained in:
parent
d577161969
commit
7ad87515ad
@ -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;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user