-
-
Notifications
You must be signed in to change notification settings - Fork 31.4k
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
gh-96678: Fix UB of null pointer arithmetic #96782
gh-96678: Fix UB of null pointer arithmetic #96782
Conversation
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.
Have the assert ever triggered in the test suite? Do you have the stack trace at that point?
Also can you add a news entry? |
Yes, the assert triggers in the test suite. You can see ths when you look at the build bot's test run for that commit. I don't know whether that build bot gives a stack trace, though. I can try to give you stack trace. |
No need, just add the NEWS entry and I can land this. Interestingly this code has been here since the beginning of time :P |
Ah, but this should have been detected by the UB buildbot no? This means that it happens only in a subprocess or there is some shenanigans again that prevent this to surface in release mode |
Ah, indeed. All failures happen in subprocesses. But this should be detected by the buildbot in any case I think. |
I explained the shenanigans in the last comment on the issue. Basically, it's only undefined behaviour in standard C. We are using -fwrapv which makes it defined behaviour. That's why the sanitiser doesn't complain. My goal here to clean this up anyway, so we can consider running without -fwrapv, and perhaps get a few more C compiler optimisations.thst way. |
But for this case we need |
In any case, I am landing the PR. Thanks a lot for working on this. Your work really makes a difference ❤️ |
Just from reading the compiler docs, I would agree. But in practice, -fwrapv seems to be enough for some reason. |
My goal is to make it so that we can run with -fstrict-overflow (if we want to.) |
@pablogsal faster-cpython/ideas#458 might be interesting for you in this context. |
The bot isn't merging this because 'awaiting review' was added mistakenly, I am fixing the labels. |
Thanks @matthiasgoergens for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10, 3.11. |
Automerge-Triggered-By: GH:pablogsal (cherry picked from commit 81e36f3) Co-authored-by: Matthias Görgens <matthias.goergens@gmail.com>
GH-96796 is a backport of this pull request to the 3.11 branch. |
GH-96797 is a backport of this pull request to the 3.10 branch. |
Automerge-Triggered-By: GH:pablogsal (cherry picked from commit 81e36f3) Co-authored-by: Matthias Görgens <matthias.goergens@gmail.com>
main
and 3.11 #96678Automerge-Triggered-By: GH:pablogsal