-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
bpo-46561: Ensure operands to __get__ survive the call #30979
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
base: main
Are you sure you want to change the base?
Conversation
Callees can assume their parameters survive for the entire call. This violates that assumption and can cause a use-after-free. This is not an issue in CPython right now because later on in the interpreter __get__ fastcall path, the whole vector of arguments get INCREFed. However, if a program provides a different entrypoint for a vectorcall, it may crash.
8729722
to
a47eaac
Compare
The changes look good, could you add some test cases? |
I am working on making a C-API equivalent for your sample Python test code. Unfortunately, it is not so easy as making a C extension class with |
Summary: Callees can assume their parameters survive for the entire call. This violates that assumption and can cause a use-after-free. Similar to D27254519. See python/cpython#30979. Reviewed By: swtaarrs Differential Revision: D33699901 fbshipit-source-id: 677d97d
Lol, did this finally bite someone else? |
I am on a mission to review old PRs that were not reviewed by anybody. LGTM, but please fix the NEWS entry (and its text is not very clear, it could be improved). It would be nice to add tests, but if it is too complicated, it is not necessary. |
The following commit authors need to sign the Contributor License Agreement: |
Callees can assume their parameters survive for the entire call. This
violates that assumption and can cause a use-after-free.
https://bugs.python.org/issue46561