[New-bugs-announce] [issue34462] _xxsubinterpreters: Wrong NULL check in _copy_raw_string()

Alexey Izbyshev report at bugs.python.org
Wed Aug 22 13:52:44 EDT 2018


New submission from Alexey Izbyshev <izbyshev at ispras.ru>:

The code at https://github.com/python/cpython/blob/28853a249b1d0c890b7e9ca345290bb8c1756446/Modules/_xxsubinterpretersmodule.c#L18 checks a wrong variable for NULL:

    const char *str = PyUnicode_AsUTF8(strobj);
    if (str == NULL) {
        return NULL;
    }
    char *copied = PyMem_Malloc(strlen(str)+1);
    if (str == NULL) {
        PyErr_NoMemory();
        return NULL;
    }

Reported by Svace static analyzer.

----------
components: Extension Modules
messages: 323897
nosy: eric.snow, izbyshev, serhiy.storchaka
priority: normal
severity: normal
status: open
title: _xxsubinterpreters: Wrong NULL check in _copy_raw_string()
type: behavior
versions: Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34462>
_______________________________________


More information about the New-bugs-announce mailing list