New submission from Brad Larsen <b...@bradfordlarsen.com>:
In bpo-36301, in commit f72346c47537657a287a862305f65eb5d7594fbf, a couple possible uses of uninitialized variables were introduced into Python/preconfig.c. In particular, in _PyPreConfig_Read(), along an error-handling path, the `init_utf8_mode` and `init_legacy_encoding` variables will be read uninitialized. _PyInitError _PyPreConfig_Read(_PyPreConfig *config, const _PyArgv *args) { /* ... */ if (args) { err = _PyPreCmdline_SetArgv(&cmdline, args); if (_Py_INIT_FAILED(err)) { goto done; /* ERROR HANDLING DONE HERE */ } } int init_utf8_mode = Py_UTF8Mode; /* VARIABLE INITIZLIED HERE */ #ifdef MS_WINDOWS int init_legacy_encoding = Py_LegacyWindowsFSEncodingFlag; /* VARIABLE INITIZLIED HERE */ #endif /* ... */ done: if (init_ctype_locale != NULL) { setlocale(LC_CTYPE, init_ctype_locale); PyMem_RawFree(init_ctype_locale); } _PyPreConfig_Clear(&save_config); Py_UTF8Mode = init_utf8_mode ; /* UNINITIALIZED READ HERE */ #ifdef MS_WINDOWS Py_LegacyWindowsFSEncodingFlag = init_legacy_encoding; /* UNINITIALIZED READ HERE */ #endif _PyPreCmdline_Clear(&cmdline); return err; } ---------- components: Interpreter Core messages: 339268 nosy: blarsen priority: normal severity: normal status: open title: Local variables can be used uninitialized in _PyPreConfig_Read() versions: Python 3.8 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue36496> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com