[Python-checkins] bpo-34457: Python/ast.c: Add missing NULL check to alias_for_import_name(). (GH-8852)

Serhiy Storchaka webhook-mailer at python.org
Wed Aug 22 00:55:19 EDT 2018


https://github.com/python/cpython/commit/28853a249b1d0c890b7e9ca345290bb8c1756446
commit: 28853a249b1d0c890b7e9ca345290bb8c1756446
branch: master
author: Alexey Izbyshev <izbyshev at ispras.ru>
committer: Serhiy Storchaka <storchaka at gmail.com>
date: 2018-08-22T07:55:16+03:00
summary:

bpo-34457: Python/ast.c: Add missing NULL check to alias_for_import_name(). (GH-8852)

Reported by Svace static analyzer.

files:
M Python/ast.c

diff --git a/Python/ast.c b/Python/ast.c
index 3b4cd162fcce..a91c075dae66 100644
--- a/Python/ast.c
+++ b/Python/ast.c
@@ -3252,6 +3252,8 @@ alias_for_import_name(struct compiling *c, const node *n, int store)
             break;
         case STAR:
             str = PyUnicode_InternFromString("*");
+            if (!str)
+                return NULL;
             if (PyArena_AddPyObject(c->c_arena, str) < 0) {
                 Py_DECREF(str);
                 return NULL;



More information about the Python-checkins mailing list