]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.11] gh-113842: Add missing error check for PyIter_Next() in Python/symtable.c...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 9 Jan 2024 11:09:32 +0000 (12:09 +0100)
committerGitHub <noreply@github.com>
Tue, 9 Jan 2024 11:09:32 +0000 (11:09 +0000)
(cherry picked from commit fda901a1ff94ea6cc338b74928acdbc5ee165ed7)

Co-authored-by: Yan Yanchii <yyanchiy@gmail.com>
Python/symtable.c

index 37e5c697405b1a21f3c33c4c52e45cdead82d04c..3519f62098425cef0fd157a60e40f9f5e31e7e51 100644 (file)
@@ -728,6 +728,12 @@ update_symbols(PyObject *symbols, PyObject *scopes,
         }
         Py_DECREF(name);
     }
+
+    /* Check if loop ended because of exception in PyIter_Next */
+    if (PyErr_Occurred()) {
+        goto error;
+    }
+
     Py_DECREF(itr);
     Py_DECREF(v_free);
     return 1;