]> granicus.if.org Git - python/commitdiff
MERGE: Closes #15793: Stack corruption in ssl.RAND_egd()
authorJesus Cea <jcea@jcea.es>
Tue, 11 Sep 2012 00:08:48 +0000 (02:08 +0200)
committerJesus Cea <jcea@jcea.es>
Tue, 11 Sep 2012 00:08:48 +0000 (02:08 +0200)
1  2 
Lib/test/test_ssl.py
Misc/NEWS
Modules/_ssl.c

index 51762cffc8c16892e2abb94446f0cff2216509e6,d4c5e6351a30c4dd933a7ddb8025b11a6e977213..4ce98b6ef25c783f6cd129bedb8b739953b7dc4e
@@@ -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"))
-         try:
-             ssl.RAND_egd(1)
-         except TypeError:
-             pass
-         else:
-             print("didn't raise TypeError")
 +
 +        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)
 +
+         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 de603c49100bf020c6ef1e64dd7f892605ebba1e,3b09e9633af52bbe93ae2ca573ac9f5e13b05878..d1aeaec9b558fe833ef51c82a92197749cd7a1db
+++ 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.
  
diff --cc Modules/_ssl.c
Simple merge