From: Jesus Cea Date: Tue, 11 Sep 2012 00:08:48 +0000 (+0200) Subject: MERGE: Closes #15793: Stack corruption in ssl.RAND_egd() X-Git-Tag: v3.3.1rc1~818^2^2~95 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b7a28008313f793897cc733e30c319ec2c284dbe;p=thirdparty%2FPython%2Fcpython.git MERGE: Closes #15793: Stack corruption in ssl.RAND_egd() --- b7a28008313f793897cc733e30c319ec2c284dbe diff --cc Lib/test/test_ssl.py index 51762cffc8c1,d4c5e6351a30..4ce98b6ef25c --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@@ -115,22 -103,8 +115,18 @@@ class BasicSocketTests(unittest.TestCas sys.stdout.write("\n RAND_status is %d (%s)\n" % (v, (v and "sufficient randomness") or "insufficient randomness")) + + data, is_cryptographic = ssl.RAND_pseudo_bytes(16) + self.assertEqual(len(data), 16) + self.assertEqual(is_cryptographic, v == 1) + if v: + data = ssl.RAND_bytes(16) + self.assertEqual(len(data), 16) + else: + self.assertRaises(ssl.SSLError, ssl.RAND_bytes, 16) + - try: - ssl.RAND_egd(1) - except TypeError: - pass - else: - print("didn't raise TypeError") + self.assertRaises(TypeError, ssl.RAND_egd, 1) + self.assertRaises(TypeError, ssl.RAND_egd, 'foo', 1) ssl.RAND_add("this is a random string", 75.0) def test_parse_cert(self): diff --cc Misc/NEWS index de603c49100b,3b09e9633af5..d1aeaec9b558 --- a/Misc/NEWS +++ b/Misc/NEWS @@@ -205,11 -152,11 +205,14 @@@ Librar - Issue #15199: Fix JavaScript's default MIME type to application/javascript. Patch by Bohuslav Kabrda. +- Issue #12643: code.InteractiveConsole now respects sys.excepthook when + displaying exceptions (Patch by Aaron Iles) + - Issue #13579: string.Formatter now understands the 'a' conversion specifier. + - Issue #15793: Stack corruption in ssl.RAND_egd(). + Patch by Serhiy Storchaka. + - Issue #15595: Fix subprocess.Popen(universal_newlines=True) for certain locales (utf-16 and utf-32 family). Patch by Chris Jerdonek.