-
Notifications
You must be signed in to change notification settings - Fork 159
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
Fixed "illegal literal" error when JSON-decoding NaN. #979
Conversation
Thanks! Do you know if this problem also occurs with |
(and negative infinity) |
I'm wondering whether this is an issue in |
@icristescu @craigfe Oh, thanks, I didn't think to check these ones. They do not work either, unsurprisingly. I'll update the PR using @hannesm I agree in principle, but don't you think it would be wiser to fix the issue on our side first, and then wait for our pull request to be merged before we remove the fix and bump the dependency? |
All non-standard floating-point values ( |
I agree with @hannesm that this is Jsonm's problem. I suggest we report the issue there and see what comes of it; perhaps a different solution will be chosen there, requiring us to adapt here. |
Trying to fix in Jsonm first indeed seems better! |
As explained in jsonm/#12, this is apparently the expected behavior of |
Could you rebase this PR on master? Thanks! |
@samoht Sure! |
I'm converting to draft for the time being since the PR breaks the It seems that I'll quickly submit another PR to solve this issue by removing the dependency of |
While running the fuzzer, I discovered that we don't properly support the floating-point value
NaN
.When converting it into JSON, we pass it to Jsonm which produces the token
nan
(because Jsonm usesstring_of_float
andstring_of_float Float.nan = "nan"
). Yet, sincenan
is not a valid JSON token according to the specification, Jsonm doesn't know how to print it and fails with an "illegal literal" error when decoding.This pull request fixes the issue by encoding
NaN
floats tonull
.