From b438a0762284d9e9b3c5f8661557e698b0f70e02 Mon Sep 17 00:00:00 2001 From: Bradford Larsen Date: Sun, 31 Mar 2019 12:48:45 -0400 Subject: [PATCH] bpo-36496: Fix two possible uninitialized reads --- Python/preconfig.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Python/preconfig.c b/Python/preconfig.c index 7ac645d7f08b20..2c85252c21deb2 100644 --- a/Python/preconfig.c +++ b/Python/preconfig.c @@ -719,6 +719,13 @@ _PyPreConfig_Read(_PyPreConfig *config, const _PyArgv *args) /* Set LC_CTYPE to the user preferred locale */ _Py_SetLocaleFromEnv(LC_CTYPE); + int init_utf8_mode = Py_UTF8Mode; +#ifdef MS_WINDOWS + int init_legacy_encoding = Py_LegacyWindowsFSEncodingFlag; +#endif + int locale_coerced = 0; + int loops = 0; + _PyPreCmdline cmdline = _PyPreCmdline_INIT; if (args) { err = _PyPreCmdline_SetArgv(&cmdline, args); @@ -727,13 +734,6 @@ _PyPreConfig_Read(_PyPreConfig *config, const _PyArgv *args) } } - int init_utf8_mode = Py_UTF8Mode; -#ifdef MS_WINDOWS - int init_legacy_encoding = Py_LegacyWindowsFSEncodingFlag; -#endif - int locale_coerced = 0; - int loops = 0; - while (1) { int utf8_mode = config->utf8_mode;