-
-
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
Add support for high-precision numbers in UBJSON encoding #2297
Conversation
…2286 � Conflicts: � single_include/nlohmann/json.hpp
There is a SIGSEGV when executing the tests with MSVC 2019. I cannot reproduce this issue on my machine (macOS), and since there is no issue when running with Valgrind or the sanitizers, I have no idea what to do. |
It is not 100% reproducible. Worked 5 times, once crashed with
If I only run that sub case with |
Can you get a stack trace? I have no idea what even goes wrong... |
I was able to reproduce this issue under the debugger and obtain the stack trace. This is a quite a classical stack exhaustion case due to large functions and recursion. The 'get_ubjson_value' function stack demands grew, and some of the tests started failing in debug mode. The test consumed 1 MiB of stack space and crashed. In non-debug mode, with all the optimizations, the test passes. Basically, in debug mode, the compiler (not only MSVC compiler, others do the same) does not efficiently merge the stack of various unrelated blocks. Consider this example: In order to verify the theory that the newly added code is overfilling the stack size limit, I did a quick hack and wrapped the new code inside the added "case 'H'" switch branch into the lambda object, and the test passed. The easiest mitigation would be to extract the new "case 'H'" code into a separate method. This way, the 'get_ubjson_value' method stack demands will shrink, and the test will pass. Alternatively, the test may be altered to provide the larger stack. |
…2286 � Conflicts: � single_include/nlohmann/json.hpp
@fmotty Thanks so much for the detailed analysis! |
@fmotty Thanks for chiming in! |
…2286 � Conflicts: � single_include/nlohmann/json.hpp
🔖 Release itemThis issue/PR will be part of the next release of the library. This template helps preparing the release notes. Type
Description
|
This PR adds high-precision numbers for UBJSON.
Closes #2286.