Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 33.9k
gh-102509: Start initializing ob_digit of _PyLongValue#102510
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
illia-v commented Mar 7, 2023 • edited by bedevere-bot
Loading Uh oh!
There was an error while loading. Please reload this page.
edited by bedevere-bot
Uh oh!
There was an error while loading. Please reload this page.
mdickinson commented Mar 18, 2023 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
@illia-v Can you provide Python code that reproduces the access of the uninitialized value? The theory is that it shouldn't matter that this digit is uninitialized when I'm not convinced that |
mdickinson commented Mar 18, 2023
I think I see. In the case So I think this counts as a false positive, and no fix is necessary. |
mdickinson commented Mar 18, 2023
Pinging @markshannon, who introduced this logic: Mark, I don't see any issue here, and think this should be closed. Agreed? |
mdickinson commented Mar 18, 2023
It may still be worth adding a comment in |
mdickinson commented Mar 18, 2023
To be clear, if this weren't a hot path then I'd probably add the extra initialization just for peace of mind, but |
markshannon commented Mar 18, 2023
This does seem to be a real bug.
Are you sure about this? I expect this code to go when #101291 is implemented, so we might as well fix it for now. |
mdickinson commented Mar 18, 2023
Fairly sure, yes. :-) We either get an uninitialised value (which is fine), or a trap representation (which is not), but trap representations in integers are not a practical problem these days. Here's a good Stack Overflow answer by Eric Postpischil that quotes chapter and verse: https://stackoverflow.com/a/66840190/270986 |
mdickinson commented Mar 18, 2023
It should be fine - at that point, the uninitialised value is some value of type |
illia-v commented Mar 18, 2023
I am not very familiar with this part of CPython source, but comments and code itself mention not only Lines 25 to 34 in 3adb23a
|
mdickinson commented Mar 19, 2023
Yes, but if If this goes in, we should have a comment explaining why the extra initialization is necessary (possibly with a pointer to this PR or the associated issue), and this comment in My preferred solution here would be to go back to a more obviously correct spelling for |
markshannon commented Jul 28, 2023
The performance impact of this change is in the noise. |
markshannon commented Jul 28, 2023
We expect the internals of |
miss-islington commented Jul 30, 2023
Thanks @illia-v for the PR, and @markshannon for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12. |
bedevere-bot commented Jul 30, 2023
GH-107464 is a backport of this pull request to the 3.12 branch. |
…honGH-102510) (cherry picked from commit fc130c4) Co-authored-by: Illia Volochii <illia.volochii@gmail.com>
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=51574 detected an uninitialized value.
I can reproduce the error by running
CC=clang ./configure --with-memory-sanitizer && make -j12locally. When I initializeresult->long_value.ob_digit[0]explicitly, the error looks to be fixed (actually a new error similar to one described in #91043 (comment) appears.)