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

Miss Islington (bot) webhook-mailer at python.org
Wed Aug 22 01:54:58 EDT 2018


https://github.com/python/cpython/commit/0ef61ee7b194a1c15747d6bca3cf30a5c581e7e3
commit: 0ef61ee7b194a1c15747d6bca3cf30a5c581e7e3
branch: 3.6
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2018-08-22T01:54:55-04:00
summary:

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


Reported by Svace static analyzer.
(cherry picked from commit 28853a249b1d0c890b7e9ca345290bb8c1756446)

Co-authored-by: Alexey Izbyshev <izbyshev at ispras.ru>

files:
M Python/ast.c

diff --git a/Python/ast.c b/Python/ast.c
index ede7f4fd990c..51175cdb55e6 100644
--- a/Python/ast.c
+++ b/Python/ast.c
@@ -3267,6 +3267,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