fastfloat / fast_float

Fast and exact implementation of the C++ from_chars functions for number types: 4x to 10x faster than strtod, part of GCC 12, Chromium and WebKit/Safari
Apache License 2.0
1.35k stars 124 forks source link

Disallow empty exponent in JSON parsing #251

Closed LeszekSwirski closed 1 month ago

LeszekSwirski commented 1 month ago

The JSON spec requires at least one digit in the exponential part, if specified.

lemire commented 1 month ago

Running tests

lemire commented 1 month ago

The GCC 13 CI error appears unrelated.

lemire commented 1 month ago

I am going to merge this and release a patch. The fix seems obviously needed. There is a problem with GCC 13 in CI, but I will fix it separately before releasing.

LeszekSwirski commented 1 month ago

So giving this a second thought, I'm not sure it's correct -- fast_float is tolerant of junk after the number, and for 1.0e, parsing this as 1.0 with trailing junk e is a valid parse. I think we should revert this and instead make tests check for the where the returned pointer ended up.