-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Assertion error (OSS-Fuzz 856) #504
Comments
The beginning of the input ( |
|
I misunderstood the problem. There was never a serialization to string, but a comparison of two NaN values. The assertion fails, because the two JSON values are treated differently. |
As of #329, NaN and infinity values can be stored inside a #include "json.hpp"
using json = nlohmann::json;
int main()
{
json j1 = NAN;
json j2 = NAN;
assert(j1 == j2); // this fails!
} This is, because the comparison is implemented as return lhs.m_value.number_float == rhs.m_value.number_float; The error here is that a NaN value is read from CBOR into a JSON value Hence, the code in the fuzzer must be adjusted. |
Input:
0xf9, 0xff, 0xff, 0x4a, 0x3a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x37, 0x02, 0x38
Example program:
The text was updated successfully, but these errors were encountered: