[pypy-commit] pypy py3.6: allow ssl tests to run without segfault, hang

mattip pypy.commits at gmail.com
Fri Aug 9 09:59:50 EDT 2019


Author: Matti Picus <matti.picus at gmail.com>
Branch: py3.6
Changeset: r97121:a405e4fc3800
Date: 2019-08-09 16:58 +0300
http://bitbucket.org/pypy/pypy/changeset/a405e4fc3800/

Log:	allow ssl tests to run without segfault, hang

diff --git a/lib-python/3/test/test_ssl.py b/lib-python/3/test/test_ssl.py
--- a/lib-python/3/test/test_ssl.py
+++ b/lib-python/3/test/test_ssl.py
@@ -3013,12 +3013,15 @@
                 self.assertEqual(s.read(-1, buffer), len(data))
                 self.assertEqual(buffer, data)  # sendall accepts bytes-like objects
 
-                if ctypes is not None:
-                    ubyte = ctypes.c_ubyte * len(data)
-                    byteslike = ubyte.from_buffer_copy(data)
-                    s.sendall(byteslike)
-                    self.assertEqual(s.read(), data)
-
+                try:
+                    if ctypes is not None:
+                        ubyte = ctypes.c_ubyte * len(data)
+                        byteslike = ubyte.from_buffer_copy(data)
+                        s.sendall(byteslike)
+                        self.assertEqual(s.read(), data)
+                except:
+                    s.close()
+                    raise
                 # Make sure sendmsg et al are disallowed to avoid
                 # inadvertent disclosure of data and/or corruption
                 # of the encrypted data stream
diff --git a/lib_pypy/_cffi_ssl/_stdssl/certificate.py b/lib_pypy/_cffi_ssl/_stdssl/certificate.py
--- a/lib_pypy/_cffi_ssl/_stdssl/certificate.py
+++ b/lib_pypy/_cffi_ssl/_stdssl/certificate.py
@@ -265,6 +265,8 @@
     count = lib.sk_DIST_POINT_num(dps)
     for i in range(count):
         dp = lib.sk_DIST_POINT_value(dps, i);
+        if not dp.distpoint:
+            return None
         gns = dp.distpoint.name.fullname;
 
         jcount = lib.sk_GENERAL_NAME_num(gns)


More information about the pypy-commit mailing list