From: Benjamin Peterson Date: Tue, 16 Aug 2016 05:01:41 +0000 (-0700) Subject: do not decref value borrowed from list (closes #27774) X-Git-Tag: v2.7.13rc1~211 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0f3596a1362a0d4bbf5daa85decb9a25b0980f52;p=thirdparty%2FPython%2Fcpython.git do not decref value borrowed from list (closes #27774) --- diff --git a/Misc/NEWS b/Misc/NEWS index 417da1397323..ce599cde984d 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -29,6 +29,8 @@ Core and Builtins Library ------- +- Issue #27774: Fix possible Py_DECREF on unowned object in _sre. + - Issue #27760: Fix possible integer overflow in binascii.b2a_qp. - In the curses module, raise an error if window.getstr() or window.instr() is diff --git a/Modules/_sre.c b/Modules/_sre.c index 829fb6bdcc87..8e16c1d140ad 100644 --- a/Modules/_sre.c +++ b/Modules/_sre.c @@ -3438,10 +3438,8 @@ match_groupdict(MatchObject* self, PyObject* args, PyObject* kw) if (!key) goto failed; value = match_getslice(self, key, def); - if (!value) { - Py_DECREF(key); + if (!value) goto failed; - } status = PyDict_SetItem(result, key, value); Py_DECREF(value); if (status < 0)