]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-101967: add a missing error check (#101968)
authorEclips4 <80244920+Eclips4@users.noreply.github.com>
Sat, 18 Feb 2023 00:52:23 +0000 (03:52 +0300)
committerGitHub <noreply@github.com>
Sat, 18 Feb 2023 00:52:23 +0000 (00:52 +0000)
Misc/NEWS.d/next/Core and Builtins/2023-02-16-23-19-01.gh-issue-101967.Kqr1dz.rst [new file with mode: 0644]
Python/ceval.c

diff --git a/Misc/NEWS.d/next/Core and Builtins/2023-02-16-23-19-01.gh-issue-101967.Kqr1dz.rst b/Misc/NEWS.d/next/Core and Builtins/2023-02-16-23-19-01.gh-issue-101967.Kqr1dz.rst
new file mode 100644 (file)
index 0000000..6e681f9
--- /dev/null
@@ -0,0 +1 @@
+Fix possible segfault in ``positional_only_passed_as_keyword`` function, when new list created.
index 09fd2f29266c87fc37df298f35ebc9b56b427f50..308ef52259df3df5ff7d4365d32bbabd3026d274 100644 (file)
@@ -1255,7 +1255,9 @@ positional_only_passed_as_keyword(PyThreadState *tstate, PyCodeObject *co,
 {
     int posonly_conflicts = 0;
     PyObject* posonly_names = PyList_New(0);
-
+    if (posonly_names == NULL) {
+        goto fail;
+    }
     for(int k=0; k < co->co_posonlyargcount; k++){
         PyObject* posonly_name = PyTuple_GET_ITEM(co->co_localsplusnames, k);