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.

classification
Title: _xxsubinterpreters: Wrong NULL check in _copy_raw_string()
Type: behavior Stage: resolved
Components: Extension Modules Versions: Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: berker.peksag, eric.snow, izbyshev, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2018-08-22 17:52 by izbyshev, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 8863 merged izbyshev, 2018-08-22 17:55
Messages (2)
msg323897 - (view) Author: Alexey Izbyshev (izbyshev) * (Python triager) Date: 2018-08-22 17:52
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.
msg323900 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2018-08-22 18:27
New changeset c583919ffced0a3b6409766fc12f6e28bef4fac7 by Berker Peksag (Alexey Izbyshev) in branch 'master':
bpo-34462: Add missing NULL check to _copy_raw_string() (GH-8863)
https://github.com/python/cpython/commit/c583919ffced0a3b6409766fc12f6e28bef4fac7
History
Date User Action Args
2022-04-11 14:59:05adminsetgithub: 78643
2018-08-22 18:28:06berker.peksagsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2018-08-22 18:27:35berker.peksagsetnosy: + berker.peksag
messages: + msg323900
2018-08-22 17:55:49izbyshevsetkeywords: + patch
stage: patch review
pull_requests: + pull_request8337
2018-08-22 17:52:44izbyshevcreate