aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hazmat/backends
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2017-03-16 16:39:35 -0400
committerPaul Kehrer <paul.l.kehrer@gmail.com>2017-03-16 16:39:35 -0400
commitd6d2527692195f074c4a384a11bbb7c6aa187826 (patch)
treea6ccff82ec1a83331c2e6a9955507c4d10be6e76 /tests/hazmat/backends
parent41e8842d4219fe96a464b0b834f18980bae6e7db (diff)
downloadcryptography-d6d2527692195f074c4a384a11bbb7c6aa187826.tar.gz
cryptography-d6d2527692195f074c4a384a11bbb7c6aa187826.tar.bz2
cryptography-d6d2527692195f074c4a384a11bbb7c6aa187826.zip
Write a memory leak test for X.509 extensions (#3451)
* Bind a pair of mem functions. * do the conditional correctly * move to the right section * Get the code basically working * flake8 * say the correct incantation * WOrkaround for hilarity * Revert "WOrkaround for hilarity" This reverts commit 37b9f3b4ed4063eef5add3bb5d5dd592a007d439. * Swap out these functions for the originals * nonsense for windows * try writing this all out for windows * Debugging utility * Avoid this mess, don't dlopen anything * Throw away this FFI entirely * first pass at some x.509 memleak tests * TODO and fix * Get the tests to passing * String formatting is nasty * some fixes because rebasing * fix for the name API, always use the OpenSSL backend
Diffstat (limited to 'tests/hazmat/backends')
-rw-r--r--tests/hazmat/backends/test_openssl_memleak.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/hazmat/backends/test_openssl_memleak.py b/tests/hazmat/backends/test_openssl_memleak.py
index 8df54774..e4cbd0fb 100644
--- a/tests/hazmat/backends/test_openssl_memleak.py
+++ b/tests/hazmat/backends/test_openssl_memleak.py
@@ -163,3 +163,25 @@ class TestAssertNoMemoryLeaks(object):
def func():
raise ZeroDivisionError
"""))
+
+
+@skip_if_memtesting_not_supported()
+class TestOpenSSLMemoryLeaks(object):
+ @pytest.mark.parametrize("path", [
+ "x509/PKITS_data/certs/ValidcRLIssuerTest28EE.crt",
+ ])
+ def test_x509_extensions(self, path):
+ assert_no_memory_leaks(textwrap.dedent("""
+ def func(path):
+ from cryptography import x509
+ from cryptography.hazmat.backends.openssl import backend
+
+ import cryptography_vectors
+
+ with cryptography_vectors.open_vector_file(path, "rb") as f:
+ cert = x509.load_der_x509_certificate(
+ f.read(), backend
+ )
+
+ cert.extensions
+ """), [path])