summaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authorKumar Aditya <59607654+kumaraditya303@users.noreply.github.com>2022-12-28 04:41:27 (GMT)
committerGitHub <noreply@github.com>2022-12-28 04:41:27 (GMT)
commitebe428824d9c749577256cbcfb35945d8b19c479 (patch)
treeb0f71b3b9f2da68b58b8c601d6a6e5bdd688266e /Tools
parentfba8c7cf740433cc71280ea6dce6b44ee477b2d3 (diff)
downloadcpython-ebe428824d9c749577256cbcfb35945d8b19c479.zip
cpython-ebe428824d9c749577256cbcfb35945d8b19c479.tar.gz
cpython-ebe428824d9c749577256cbcfb35945d8b19c479.tar.bz2
[3.11] GH-100342: check for allocation failure in AC `*args` parsing (GH-100343). (#100568)
(cherry picked from commit 7cf164ad5e3c8c6af5ae8813ad6a784448605418) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Diffstat (limited to 'Tools')
-rwxr-xr-xTools/clinic/clinic.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py
index a6d8b86..82e4919 100755
--- a/Tools/clinic/clinic.py
+++ b/Tools/clinic/clinic.py
@@ -903,12 +903,16 @@ class CLanguage(Language):
if not new_or_init:
parser_code.append(normalize_snippet("""
%s = PyTuple_New(%s);
+ if (!%s) {{
+ goto exit;
+ }}
for (Py_ssize_t i = 0; i < %s; ++i) {{
PyTuple_SET_ITEM(%s, i, Py_NewRef(args[%d + i]));
}}
""" % (
p.converter.parser_name,
left_args,
+ p.converter.parser_name,
left_args,
p.converter.parser_name,
max_pos