From 4abedd3f9f46309ca9ff51189548daefc2e37e66 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Mon, 28 Jan 2019 11:33:28 -0800 Subject: [PATCH] Check for errors from _Py_asdl_seq_new() --- Python/ast.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Python/ast.c b/Python/ast.c index 4d59344a4aa4..cad82d1d5827 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -894,6 +894,8 @@ PyAST_FromNodeObject(const node *n, PyCompilerFlags *flags, } argtypes = _Py_asdl_seq_new(num, arena); + if (!argtypes) + goto out; j = 0; for (i = 0; i < NCH(ch); i++) { @@ -905,8 +907,11 @@ PyAST_FromNodeObject(const node *n, PyCompilerFlags *flags, } } } - else + else { argtypes = _Py_asdl_seq_new(0, arena); + if (!argtypes) + goto out; + } ret = ast_for_expr(&c, CHILD(n, NCH(n) - 1)); if (!ret) -- 2.47.3