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

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


https://github.com/python/cpython/commit/5223ce2131a121201a78d0680302ea06c4a58369
commit: 5223ce2131a121201a78d0680302ea06c4a58369
branch: 2.7
author: Alexey Izbyshev <izbyshev at ispras.ru>
committer: Serhiy Storchaka <storchaka at gmail.com>
date: 2018-08-22T14:46:51+03:00
summary:

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

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 318c0bb27d35..946032589f4b 100644
--- a/Python/ast.c
+++ b/Python/ast.c
@@ -2520,6 +2520,8 @@ alias_for_import_name(struct compiling *c, const node *n, int store)
             break;
         case STAR:
             str = PyString_InternFromString("*");
+            if (!str)
+                return NULL;
             PyArena_AddPyObject(c->c_arena, str);
             return alias(str, NULL, c->c_arena);
         default:



More information about the Python-checkins mailing list