[Python-checkins] bpo-36412: fix a possible crash in dictobject.c's new_dict() (GH-12519)
Inada Naoki
webhook-mailer at python.org
Sat Mar 23 22:23:37 EDT 2019
https://github.com/python/cpython/commit/3d07c1ee1d2d475b74816117981d6ec752c26c23
commit: 3d07c1ee1d2d475b74816117981d6ec752c26c23
branch: master
author: Zackery Spytz <zspytz at gmail.com>
committer: Inada Naoki <songofacandy at gmail.com>
date: 2019-03-24T11:23:29+09:00
summary:
bpo-36412: fix a possible crash in dictobject.c's new_dict() (GH-12519)
files:
A Misc/NEWS.d/next/Core and Builtins/2019-03-23-19-51-09.bpo-36412.C7acGn.rst
M Objects/dictobject.c
diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-03-23-19-51-09.bpo-36412.C7acGn.rst b/Misc/NEWS.d/next/Core and Builtins/2019-03-23-19-51-09.bpo-36412.C7acGn.rst
new file mode 100644
index 000000000000..0146988151ee
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2019-03-23-19-51-09.bpo-36412.C7acGn.rst
@@ -0,0 +1 @@
+Fix a possible crash when creating a new dictionary.
diff --git a/Objects/dictobject.c b/Objects/dictobject.c
index 524ff67837bc..e2603e190b62 100644
--- a/Objects/dictobject.c
+++ b/Objects/dictobject.c
@@ -604,7 +604,9 @@ new_dict(PyDictKeysObject *keys, PyObject **values)
mp = PyObject_GC_New(PyDictObject, &PyDict_Type);
if (mp == NULL) {
dictkeys_decref(keys);
- free_values(values);
+ if (values != empty_values) {
+ free_values(values);
+ }
return NULL;
}
}
More information about the Python-checkins
mailing list