Files
openGauss-third_party/dependency/cryptography/CVE-2023-49083.patch
2023-12-02 16:31:15 +08:00

31 lines
1.3 KiB
Diff

diff -Naur a/src/cryptography/hazmat/backends/openssl/backend.py b/src/cryptography/hazmat/backends/openssl/backend.py
--- a/src/cryptography/hazmat/backends/openssl/backend.py 2023-12-02 16:06:27.029247885 +0800
+++ b/src/cryptography/hazmat/backends/openssl/backend.py 2023-12-02 16:03:19.239094195 +0800
@@ -2664,6 +2664,10 @@
_Reasons.UNSUPPORTED_SERIALIZATION,
)
+ certs: list[x509.Certificate] = []
+ if p7.d.sign == self._ffi.NULL:
+ return certs
+
sk_x509 = p7.d.sign.cert
num = self._lib.sk_X509_num(sk_x509)
certs = []
diff -Naur a/tests/hazmat/primitives/test_pkcs7.py b/tests/hazmat/primitives/test_pkcs7.py
--- a/tests/hazmat/primitives/test_pkcs7.py 2023-12-02 16:06:27.037247977 +0800
+++ b/tests/hazmat/primitives/test_pkcs7.py 2023-12-02 16:03:19.251094333 +0800
@@ -80,6 +80,12 @@
mode="rb",
)
+ def test_load_pkcs7_empty_certificates(self):
+ der = b"\x30\x0B\x06\x09\x2A\x86\x48\x86\xF7\x0D\x01\x07\x02"
+
+ certificates = pkcs7.load_der_pkcs7_certificates(der)
+ assert certificates == []
+
# We have no public verification API and won't be adding one until we get
# some requirements from users so this function exists to give us basic