This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author blarsen
Recipients blarsen
Date 2019-03-31.16:46:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1554050763.93.0.364085310832.issue36496@roundup.psfhosted.org>
In-reply-to
Content
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;
    }
History
Date User Action Args
2019-03-31 16:46:03blarsensetrecipients: + blarsen
2019-03-31 16:46:03blarsensetmessageid: <1554050763.93.0.364085310832.issue36496@roundup.psfhosted.org>
2019-03-31 16:46:03blarsenlinkissue36496 messages
2019-03-31 16:46:03blarsencreate