diff options
author | Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> | 2022-12-28 04:16:28 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-28 04:16:28 (GMT) |
commit | 7cf164ad5e3c8c6af5ae8813ad6a784448605418 (patch) | |
tree | 0dfb53494076e5efac98ca8ba87240d776bba9ee /Tools/clinic | |
parent | e97afefda54b818b140b3cc905642b69d9d65f0c (diff) | |
download | cpython-7cf164ad5e3c8c6af5ae8813ad6a784448605418.zip cpython-7cf164ad5e3c8c6af5ae8813ad6a784448605418.tar.gz cpython-7cf164ad5e3c8c6af5ae8813ad6a784448605418.tar.bz2 |
GH-100342: check for allocation failure in AC `*args` parsing (#100343)
Diffstat (limited to 'Tools/clinic')
-rwxr-xr-x | Tools/clinic/clinic.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py index 2fb1902..552ed2c 100755 --- a/Tools/clinic/clinic.py +++ b/Tools/clinic/clinic.py @@ -960,12 +960,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 |