Skip to content
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 in boost::json::detail::pow10(int) #21

Closed
pauldreik opened this issue Dec 4, 2019 · 5 comments
Closed

Assertion in boost::json::detail::pow10(int) #21

pauldreik opened this issue Dec 4, 2019 · 5 comments
Labels

Comments

@pauldreik
Copy link
Contributor

This was already reported in https://github.com/vinniefalco/json/issues/13#issuecomment-560517119, but here is a minimized version and I think it is good to have it in a separate issue.

I is the string 0.00....... with a lot of zeros following. Here it is, base 64 encoded:

MC4wMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAw
MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAw
MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAw
MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAw
MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAw
MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDA=

Running it through the fuzzer gives the following output:

paul@tonfisk:~/code/delaktig/boost.json/fuzzing$ ./fuzzer old_crashes/crash_01.json 
INFO: Seed: 2483239189
INFO: Loaded 1 modules   (1092 inline 8-bit counters): 1092 [0x7d21a0, 0x7d25e4), 
INFO: Loaded 1 PC tables (1092 PCs): 1092 [0x5a1598,0x5a59d8), 
./fuzzer: Running 1 inputs 1 time(s) each.
Running: old_crashes/crash_01.json
fuzzer: ../include/boost/json/detail/impl/number.ipp:96: double boost::json::detail::pow10(int): Assertion `exp >= 0 && exp < 618' failed.
pauldreik added a commit to pauldreik/json that referenced this issue Dec 4, 2019
@vinniefalco
Copy link
Member

\sigh the treatment of floating point numbers is my shame...

@pauldreik
Copy link
Contributor Author

Well it is incredibly difficult to get right :-)

@vinniefalco
Copy link
Member

It really is difficult, and unexpectedly so because..aren't computers supposed to be GOOD at math???

@vinniefalco
Copy link
Member

Promising advances in the field of string to double conversion:
https://github.com/ulfjack/ryu/commits/parsing/ryu/s2d.c

@pauldreik
Copy link
Contributor Author

This bug has been obsoleted by refactoring during the last six months, closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants