-
-
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
ordered json pointer corruption #4289
Comments
This seems related to #4279. |
As in the linked issue, you can't do that. The push_back function on vector can invalidate pointers, and ordered_json uses a vector. |
It is related to the issue you mentioned earlier, but it's certainly NOT a documentation issue. ordered_json must have working push_back function without any pointer corruption or this function must be private if it can cause such behaviour. Please fix this |
I have no idea how to fix it, so documentation is currently all we can do. |
@mishase This behavior comes from https://en.cppreference.com/w/cpp/container/vector/push_back
|
Description
When using ordered json with
push_back
call, pointer to previous structure gets corruptedReproduction steps
Use the code bellow with
nlohmann::ordered_json
to get corrupted pointerExpected vs. actual results
Expected output (same code, without ordered json):
Actual output (corrupted pointer):
Minimal code example
Error messages
No response
Compiler and operating system
Tested on ARM Windows and X64 Windows in Debug and Release modes
Library version
3.11.3
Validation
develop
branch is used.The text was updated successfully, but these errors were encountered: