-
-
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
Potential use-after-free in Py_SetPythonHome and its siblings #98978
Comments
zooba
added a commit
to zooba/cpython
that referenced
this issue
Nov 2, 2022
…l functions multiple times
This doesn't affect 3.10 because you weren't able to clear the values - the functions would exit early on null/empty strings. |
I proposed PR #99066 to fix this issue. |
vstinner
added a commit
that referenced
this issue
Nov 3, 2022
Fix use-after-free in Py_SetPythonHome(NULL), Py_SetProgramName(NULL) and _Py_SetProgramFullPath(NULL) function calls. Issue reported by Benedikt Reinartz.
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this issue
Nov 3, 2022
Fix use-after-free in Py_SetPythonHome(NULL), Py_SetProgramName(NULL) and _Py_SetProgramFullPath(NULL) function calls. Issue reported by Benedikt Reinartz. (cherry picked from commit b07f546) Co-authored-by: Victor Stinner <[email protected]>
Fixed by b07f546 |
miss-islington
added a commit
that referenced
this issue
Nov 3, 2022
Fix use-after-free in Py_SetPythonHome(NULL), Py_SetProgramName(NULL) and _Py_SetProgramFullPath(NULL) function calls. Issue reported by Benedikt Reinartz. (cherry picked from commit b07f546) Co-authored-by: Victor Stinner <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug report
cpython/Python/pathconfig.c
Lines 255 to 273 in c085974
If
Py_SetPythonHome
was called with a non-empty string and is subsequently called with an empty one, it will always runPyMem_RawFree
but only actually reset the pointer in.home
ifhas_value
is set, so ifhome && home[0]
(i.e. non-empty string).Minimal example:
Your environment
The issue occurs in our (Python.NET) test-suite: pythonnet/pythonnet#1955
Additional notes
This bug was introduced in #29041, in the initial commit: a63f5d8
It's a regression, the first faulty version was 3.11.0a3.
@vstinner @zooba
The text was updated successfully, but these errors were encountered: