mirror of
https://github.com/python/cpython
synced 2026-09-29 12:10:30 +03:00
bpo-31532: Fix memory corruption due to allocator mix (#3679)
Fix a memory corruption in getpath.c due to mixed memory allocators between Py_GetPath() and Py_SetPath(). The fix use the Raw allocator to mimic the windows version. This patch should be used from python3.6 to the current version for more details, see the bug report and https://github.com/pyinstaller/pyinstaller/issues/2812
This commit is contained in:
parent
b091bec824
commit
3d1e2ab584
2 changed files with 3 additions and 1 deletions
|
|
@ -0,0 +1,2 @@
|
|||
Fix memory corruption due to allocator mix in getpath.c between Py_GetPath()
|
||||
and Py_SetPath()
|
||||
|
|
@ -735,7 +735,7 @@ calculate_path(void)
|
|||
bufsz += wcslen(zip_path) + 1;
|
||||
bufsz += wcslen(exec_prefix) + 1;
|
||||
|
||||
buf = PyMem_New(wchar_t, bufsz);
|
||||
buf = PyMem_RawMalloc(bufsz * sizeof(wchar_t));
|
||||
if (buf == NULL) {
|
||||
Py_FatalError(
|
||||
"Not enough memory for dynamic PYTHONPATH");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue