python2/00158-fix-hashlib-leak.patch
David Malcolm 42d74be742 2.7.3-17: remove "_default_patch_fuzz" directive
* Tue Feb 19 2013 David Malcolm <dmalcolm@redhat.com> - 2.7.3-17
- remove "_default_patch_fuzz" directive to avoid patches being silently
misapplied (refresh patch 1, patch 101, patch 102, patch 111, patch 121,
patch 158; rename patch 1, patch 101, patch 121; apply patch 54 before the
lib64 patches to avoid fuzz problems caused by the conditional application
of the lib64 patches)
2013-02-19 15:20:28 -05:00

30 lines
1.3 KiB
Diff

diff -up Python-2.7.3/Lib/test/test_hashlib.py.fix-hashlib-leak Python-2.7.3/Lib/test/test_hashlib.py
--- Python-2.7.3/Lib/test/test_hashlib.py.fix-hashlib-leak 2013-02-19 14:13:44.000000000 -0500
+++ Python-2.7.3/Lib/test/test_hashlib.py 2013-02-19 14:14:31.319948742 -0500
@@ -106,12 +106,8 @@ class HashLibTestCase(unittest.TestCase)
_algo.islower()]))
def test_unknown_hash(self):
- try:
- hashlib.new('spam spam spam spam spam')
- except ValueError:
- pass
- else:
- self.assertTrue(0 == "hashlib didn't reject bogus hash name")
+ self.assertRaises(ValueError, hashlib.new, 'spam spam spam spam spam')
+ self.assertRaises(TypeError, hashlib.new, 1)
def test_hexdigest(self):
for name in self.supported_hash_names:
diff -up Python-2.7.3/Modules/_hashopenssl.c.fix-hashlib-leak Python-2.7.3/Modules/_hashopenssl.c
--- Python-2.7.3/Modules/_hashopenssl.c.fix-hashlib-leak 2013-02-19 14:13:44.646951933 -0500
+++ Python-2.7.3/Modules/_hashopenssl.c 2013-02-19 14:13:44.715951929 -0500
@@ -549,6 +549,7 @@ EVP_new(PyObject *self, PyObject *args,
}
if (!PyArg_Parse(name_obj, "s", &name)) {
+ PyBuffer_Release(&view);
PyErr_SetString(PyExc_TypeError, "name must be a string");
return NULL;
}