gh-133590: ensure that TableEntry.linenumber_borrow is initialized#133681
gh-133590: ensure that TableEntry.linenumber_borrow is initialized#133681picnixz merged 6 commits intopython:mainfrom
TableEntry.linenumber_borrow is initialized#133681Conversation
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
picnixz
left a comment
There was a problem hiding this comment.
One could argue that it's not an undefined behavior as linenumber_borrow will always be set to something before it's read but accessing it while uninitialized is indeed UB.
TableEntry.linenumber_borrow is initialized
|
CI seems stuck. I'll close/reopen your PR. |
…lized (pythonGH-133681) (cherry picked from commit c838e21) Co-authored-by: Lauta <ljfp@ljfp.xyz>
|
GH-133872 is a backport of this pull request to the 3.14 branch. |
Since the author decided to initialize
filename_borrowto NULL, I think thatlinenumber_borrowshould also be initialized (likely to 0).In its current state it could become an issue in the report_leak() function if for some reason
entry->linenumber_borrow = linenumber;fails to be executed and then linenumber_borrow is accessed when filename_borrow is non-NULL. I'm not sure if this code path is possible at all, but initializing linenumber_borrow shouldn't have any side-effects.If this was left intentionally uninitialized for some reason, it would be a good idea to close this PR and open another one documenting the motive behind leaving it like this.
Also, stackrefs.c had a blank line at the beginning of the file (!!); I took the liberty to remove it.
linenumber_borrowfield of theTableEntrystruct #133590