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
Fix: do not add an offset to a nullptr #8351
Conversation
01682da
to
36fb6b7
Compare
Are there any additional changes (asserts, etc) that could be added to prevent this mistake from being made in future? |
36fb6b7
to
d2eda62
Compare
Went for a slightly different direction; turns out there were more places that are or could potentially feed a |
d2eda62
to
3d0f337
Compare
And something is wrong: when saving the date,
This is caused by |
This is, by specs, undefined behaviour. See https://reviews.llvm.org/D67122 In cases where this is done, optimizations done by LLVM can generate code that causes crashes. GetVariableAddress() had two (legit) ways this could happen: - For SaveLoad set to global - For SaveLoad set to SLE_VAR_NULL, where sld->address is always a nullptr, and object could or could not be a nullptr.
3d0f337
to
b05b316
Compare
This function is something. This patch changes the behaviour a bit: when a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything about this bit of the code is horrifying, but I'm happy you've tested it well enough :)
While at it, prevent a potential cases where an offset would be added to a
nullptr
(which would be horrible wrong for completely different reasons).Tnx to milek7 for tracing the root cause.