summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@python.org>2020-07-06 16:32:00 (GMT)
committerGitHub <noreply@github.com>2020-07-06 16:32:00 (GMT)
commitdcbaa1b49cd9062fb9ba2b9d49555ac6cd8c60b5 (patch)
tree4b1d3d5130de1db92de3240f4decc656ee7247ef /Python
parentdeb016224cc506503fb05e821a60158c83918ed4 (diff)
downloadcpython-dcbaa1b49cd9062fb9ba2b9d49555ac6cd8c60b5.zip
cpython-dcbaa1b49cd9062fb9ba2b9d49555ac6cd8c60b5.tar.gz
cpython-dcbaa1b49cd9062fb9ba2b9d49555ac6cd8c60b5.tar.bz2
bpo-29778: Ensure python3.dll is loaded from correct locations when Python is embedded (GH-21297)
Also enables using debug build of `python3_d.dll` Reference: CVE-2020-15523
Diffstat (limited to 'Python')
-rw-r--r--Python/dynload_win.c2
-rw-r--r--Python/pathconfig.c46
2 files changed, 0 insertions, 48 deletions
diff --git a/Python/dynload_win.c b/Python/dynload_win.c
index 2bf3384..8431c5b 100644
--- a/Python/dynload_win.c
+++ b/Python/dynload_win.c
@@ -168,9 +168,7 @@ dl_funcptr _PyImport_FindSharedFuncptrWindows(const char *prefix,
char funcname[258], *import_python;
const wchar_t *wpathname;
-#ifndef _DEBUG
_Py_CheckPython3();
-#endif
wpathname = _PyUnicode_AsUnicode(pathname);
if (wpathname == NULL)
diff --git a/Python/pathconfig.c b/Python/pathconfig.c
index 5c38041..9a30221 100644
--- a/Python/pathconfig.c
+++ b/Python/pathconfig.c
@@ -17,9 +17,6 @@ extern "C" {
_PyPathConfig _Py_path_config = _PyPathConfig_INIT;
-#ifdef MS_WINDOWS
-wchar_t *_Py_dll_path = NULL;
-#endif
static int
@@ -107,10 +104,6 @@ _PyPathConfig_ClearGlobal(void)
_PyMem_SetDefaultAllocator(PYMEM_DOMAIN_RAW, &old_alloc);
pathconfig_clear(&_Py_path_config);
-#ifdef MS_WINDOWS
- PyMem_RawFree(_Py_dll_path);
- _Py_dll_path = NULL;
-#endif
PyMem_SetAllocator(PYMEM_DOMAIN_RAW, &old_alloc);
}
@@ -147,31 +140,6 @@ _PyWideStringList_Join(const PyWideStringList *list, wchar_t sep)
}
-#ifdef MS_WINDOWS
-/* Initialize _Py_dll_path on Windows. Do nothing on other platforms. */
-static PyStatus
-_PyPathConfig_InitDLLPath(void)
-{
- if (_Py_dll_path != NULL) {
- /* Already set: nothing to do */
- return _PyStatus_OK();
- }
-
- PyMemAllocatorEx old_alloc;
- _PyMem_SetDefaultAllocator(PYMEM_DOMAIN_RAW, &old_alloc);
-
- _Py_dll_path = _Py_GetDLLPath();
-
- PyMem_SetAllocator(PYMEM_DOMAIN_RAW, &old_alloc);
-
- if (_Py_dll_path == NULL) {
- return _PyStatus_NO_MEMORY();
- }
- return _PyStatus_OK();
-}
-#endif
-
-
static PyStatus
pathconfig_set_from_config(_PyPathConfig *pathconfig, const PyConfig *config)
{
@@ -222,13 +190,6 @@ done:
PyStatus
_PyConfig_WritePathConfig(const PyConfig *config)
{
-#ifdef MS_WINDOWS
- PyStatus status = _PyPathConfig_InitDLLPath();
- if (_PyStatus_EXCEPTION(status)) {
- return status;
- }
-#endif
-
return pathconfig_set_from_config(&_Py_path_config, config);
}
@@ -455,13 +416,6 @@ pathconfig_global_init(void)
{
PyStatus status;
-#ifdef MS_WINDOWS
- status = _PyPathConfig_InitDLLPath();
- if (_PyStatus_EXCEPTION(status)) {
- Py_ExitStatusException(status);
- }
-#endif
-
if (_Py_path_config.module_search_path == NULL) {
status = pathconfig_global_read(&_Py_path_config);
if (_PyStatus_EXCEPTION(status)) {