[poppler] 3 commits - poppler/SignatureHandler.cc poppler/SignatureInfo.cc poppler/SignatureInfo.h

Albert Astals Cid aacid at kemper.freedesktop.org
Sun Jul 22 22:19:40 UTC 2018


 poppler/SignatureHandler.cc |    7 -------
 poppler/SignatureInfo.cc    |    6 ++++--
 poppler/SignatureInfo.h     |    4 ++--
 3 files changed, 6 insertions(+), 11 deletions(-)

New commits:
commit f9c7d61e36bb1fb0c77681b993fe5f4c2b1cd37e
Author: Albert Astals Cid <aacid at kde.org>
Date:   Mon Jul 23 00:19:17 2018 +0200

    Don't free signeddata nor signerinfo
    
    They get freed as part of freeing CMSMessage

diff --git a/poppler/SignatureHandler.cc b/poppler/SignatureHandler.cc
index a944ce3f..f748d153 100644
--- a/poppler/SignatureHandler.cc
+++ b/poppler/SignatureHandler.cc
@@ -164,10 +164,6 @@ void SignatureHandler::updateHash(unsigned char * data_block, int data_len)
 SignatureHandler::~SignatureHandler()
 {
   SECITEM_FreeItem(&CMSitem, PR_FALSE);
-  if (CMSSignerInfo)
-    NSS_CMSSignerInfo_Destroy(CMSSignerInfo);
-  if (CMSSignedData)
-    NSS_CMSSignedData_Destroy(CMSSignedData);
   if (CMSMessage)
     NSS_CMSMessage_Destroy(CMSMessage);
 
commit 54a75cb091b0994290e6b398b98e3113cd61355a
Author: Albert Astals Cid <aacid at kde.org>
Date:   Mon Jul 23 00:18:50 2018 +0200

    Don't destroy the cert, doesn't belong to us

diff --git a/poppler/SignatureHandler.cc b/poppler/SignatureHandler.cc
index 6ddd1a84..a944ce3f 100644
--- a/poppler/SignatureHandler.cc
+++ b/poppler/SignatureHandler.cc
@@ -318,9 +318,6 @@ SECErrorCodes SignatureHandler::validateCertificate(time_t validation_time)
 
   retVal = (SECErrorCodes) PORT_GetError();
 
-  if (cert)
-    CERT_DestroyCertificate(cert);
-
   return retVal;
 }
 
commit 36f317d488d8ce6efb69db89a2eca09a98553ab5
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sun Jul 22 23:48:03 2018 +0200

    Copy subject dn instead of storing it
    
    It comes deep from the cert memory so it's destroyed shorting after and
    thus is invalid if we don't copy it

diff --git a/poppler/SignatureInfo.cc b/poppler/SignatureInfo.cc
index 7ca8b969..b5314334 100644
--- a/poppler/SignatureInfo.cc
+++ b/poppler/SignatureInfo.cc
@@ -7,7 +7,7 @@
 // Copyright 2015 André Guerreiro <aguerreiro1985 at gmail.com>
 // Copyright 2015 André Esser <bepandre at hotmail.com>
 // Copyright 2017 Hans-Ulrich Jüttner <huj at froreich-bioscientia.de>
-// Copyright 2017 Albert Astals Cid <aacid at kde.org>
+// Copyright 2017, 2018 Albert Astals Cid <aacid at kde.org>
 //
 //========================================================================
 
@@ -51,6 +51,7 @@ SignatureInfo::SignatureInfo(SignatureValidationStatus sig_val_status, Certifica
 SignatureInfo::~SignatureInfo()
 {
   free(signer_name);
+  free(subject_dn);
 }
 
 /* GETTERS */
@@ -105,7 +106,8 @@ void SignatureInfo::setSignerName(char *signerName)
 
 void SignatureInfo::setSubjectDN(const char *subjectDN)
 {
-  subject_dn = subjectDN;
+  free(subject_dn);
+  subject_dn = strdup(subjectDN);
 }
 
 void SignatureInfo::setHashAlgorithm(int type)
diff --git a/poppler/SignatureInfo.h b/poppler/SignatureInfo.h
index 35e7568c..b99e4151 100644
--- a/poppler/SignatureInfo.h
+++ b/poppler/SignatureInfo.h
@@ -6,7 +6,7 @@
 //
 // Copyright 2015 André Guerreiro <aguerreiro1985 at gmail.com>
 // Copyright 2015 André Esser <bepandre at hotmail.com>
-// Copyright 2015, 2017 Albert Astals Cid <aacid at kde.org>
+// Copyright 2015, 2017, 2018 Albert Astals Cid <aacid at kde.org>
 // Copyright 2017 Hans-Ulrich Jüttner <huj at froreich-bioscientia.de>
 //
 //========================================================================
@@ -69,7 +69,7 @@ private:
   SignatureValidationStatus sig_status;
   CertificateValidationStatus cert_status;
   char *signer_name;
-  const char *subject_dn;
+  char *subject_dn;
   int hash_type;
   time_t signing_time;
   bool sig_subfilter_supported;


More information about the poppler mailing list