Kaydet (Commit) d958cc96 authored tarafından Amaury Forgeot d'Arc's avatar Amaury Forgeot d'Arc

Issue #15219: Fix a reference leak when hashlib.new() is called with

invalid parameters.
üst 45f0d983
...@@ -108,12 +108,8 @@ class HashLibTestCase(unittest.TestCase): ...@@ -108,12 +108,8 @@ class HashLibTestCase(unittest.TestCase):
_algo.islower()])) _algo.islower()]))
def test_unknown_hash(self): def test_unknown_hash(self):
try: self.assertRaises(ValueError, hashlib.new, 'spam spam spam spam spam')
hashlib.new('spam spam spam spam spam') self.assertRaises(TypeError, hashlib.new, 1)
except ValueError:
pass
else:
self.assertTrue(0 == "hashlib didn't reject bogus hash name")
def test_get_builtin_constructor(self): def test_get_builtin_constructor(self):
get_builtin_constructor = hashlib.__dict__[ get_builtin_constructor = hashlib.__dict__[
......
...@@ -75,6 +75,9 @@ Core and Builtins ...@@ -75,6 +75,9 @@ Core and Builtins
Library Library
------- -------
- Issue #15219: Fix a reference leak when hashlib.new() is called with
invalid parameters.
- Issue #9559: If messages were only added, a new file is no longer - Issue #9559: If messages were only added, a new file is no longer
created and renamed over the old file when flush() is called on an created and renamed over the old file when flush() is called on an
mbox, MMDF or Babyl mailbox. mbox, MMDF or Babyl mailbox.
......
...@@ -477,6 +477,7 @@ EVP_new(PyObject *self, PyObject *args, PyObject *kwdict) ...@@ -477,6 +477,7 @@ EVP_new(PyObject *self, PyObject *args, PyObject *kwdict)
} }
if (!PyArg_Parse(name_obj, "s", &name)) { if (!PyArg_Parse(name_obj, "s", &name)) {
PyBuffer_Release(&view);
PyErr_SetString(PyExc_TypeError, "name must be a string"); PyErr_SetString(PyExc_TypeError, "name must be a string");
return NULL; return NULL;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment