[Python-checkins] bpo-36374: Fix a possible null pointer dereference (GH-12449)

Miss Islington (bot) webhook-mailer at python.org
Wed Mar 20 05:16:30 EDT 2019


https://github.com/python/cpython/commit/9b4a1b1e23d4a7cb18ad26f405bdc741af69f342
commit: 9b4a1b1e23d4a7cb18ad26f405bdc741af69f342
branch: master
author: Zackery Spytz <zspytz at gmail.com>
committer: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
date: 2019-03-20T02:16:25-07:00
summary:

bpo-36374: Fix a possible null pointer dereference (GH-12449)



https://bugs.python.org/issue36374

files:
A Misc/NEWS.d/next/Core and Builtins/2019-03-19-15-46-42.bpo-36374.EWKMZE.rst
M Python/compile.c

diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-03-19-15-46-42.bpo-36374.EWKMZE.rst b/Misc/NEWS.d/next/Core and Builtins/2019-03-19-15-46-42.bpo-36374.EWKMZE.rst
new file mode 100644
index 000000000000..2eac30136854
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2019-03-19-15-46-42.bpo-36374.EWKMZE.rst	
@@ -0,0 +1,2 @@
+Fix a possible null pointer dereference in ``merge_consts_recursive()``.
+Patch by Zackery Spytz.
diff --git a/Python/compile.c b/Python/compile.c
index 697833752bb0..3656a7e00efd 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -1210,7 +1210,7 @@ merge_consts_recursive(struct compiler *c, PyObject *o)
     PyObject *t = PyDict_SetDefault(c->c_const_cache, key, key);
     if (t != key) {
         // o is registered in c_const_cache.  Just use it.
-        Py_INCREF(t);
+        Py_XINCREF(t);
         Py_DECREF(key);
         return t;
     }



More information about the Python-checkins mailing list