]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix potential NULL pointer dereference in update_symbols()
authorChristian Heimes <christian@python.org>
Thu, 8 Sep 2016 22:22:28 +0000 (00:22 +0200)
committerChristian Heimes <christian@python.org>
Thu, 8 Sep 2016 22:22:28 +0000 (00:22 +0200)
symtable_analyze() calls analyze_block() with bound=NULL. Theoretically
that NULL can be passed down to update_symbols(). update_symbols() may
deference NULL and pass it to PySet_Contains()

Python/symtable.c

index 3f03184f088ac767c619697b0fac30d3ba765a14..45a8c2c64bd90f422b03fc17465316621d446ed1 100644 (file)
@@ -652,7 +652,7 @@ update_symbols(PyObject *symbols, PyObject *scopes,
             continue;
         }
         /* Handle global symbol */
-        if (!PySet_Contains(bound, name)) {
+        if (bound && !PySet_Contains(bound, name)) {
             Py_DECREF(name);
             continue;       /* it's a global */
         }