[poppler] utils/pdfsig.cc

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jun 5 09:24:15 UTC 2023


 utils/pdfsig.cc |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit fa00b3fbbd62c5b6b5383d9997a9d5c30827b386
Author: Sune Vuorela <sune at vuorela.dk>
Date:   Mon Jun 5 11:09:09 2023 +0200

    Fix cornercase crash in weird pdfsig setups
    
    This fixes a potential crash in setups where at least one cryptographic
    signature backend is compiled in, but none is functional.

diff --git a/utils/pdfsig.cc b/utils/pdfsig.cc
index b78169d8..0baf0d09 100644
--- a/utils/pdfsig.cc
+++ b/utils/pdfsig.cc
@@ -202,7 +202,13 @@ static std::vector<std::unique_ptr<X509CertificateInfo>> getAvailableSigningCert
         }
     };
     NSSSignatureConfiguration::setNSSPasswordCallback(passwordCallback);
-    std::vector<std::unique_ptr<X509CertificateInfo>> vCerts = CryptoSign::Factory::createActive()->getAvailableSigningCertificates();
+    auto backend = CryptoSign::Factory::createActive();
+    if (!backend) {
+        *error = true;
+        printf("No backends for cryptographic signatures available");
+        return {};
+    }
+    std::vector<std::unique_ptr<X509CertificateInfo>> vCerts = backend->getAvailableSigningCertificates();
     NSSSignatureConfiguration::setNSSPasswordCallback({});
     if (passwordNeeded) {
         *error = true;


More information about the poppler mailing list