[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - xmlsecurity/source

Samuel Mehrbrodt Samuel.Mehrbrodt at cib.de
Wed Jun 28 15:25:36 UTC 2017


 xmlsecurity/source/gpg/CertificateImpl.cxx      |    7 +++++--
 xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx |    7 +++++--
 2 files changed, 10 insertions(+), 4 deletions(-)

New commits:
commit 4cdf803af7bc548cb614eb843ab216e264e485c9
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date:   Wed Jun 28 09:12:35 2017 +0200

    gpg4libre: Don't call production code inside an assert()
    
    Won't work in non-debug builds
    
    Change-Id: I64f9c416890ddd02ec8efc0f59ded145cc17896a
    Reviewed-on: https://gerrit.libreoffice.org/39345
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
    (cherry picked from commit 9a884b3d055ffdedbadb64c7f14e6d38078dedb1)
    Reviewed-on: https://gerrit.libreoffice.org/39353
    Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>

diff --git a/xmlsecurity/source/gpg/CertificateImpl.cxx b/xmlsecurity/source/gpg/CertificateImpl.cxx
index 20fa35c52d5d..03fa49cdef68 100644
--- a/xmlsecurity/source/gpg/CertificateImpl.cxx
+++ b/xmlsecurity/source/gpg/CertificateImpl.cxx
@@ -217,14 +217,17 @@ void CertificateImpl::setCertificate(GpgME::Context* ctx, const GpgME::Key& key)
     if (err)
         throw RuntimeException("The GpgME library failed to retrieve the public key");
 
-    assert(data_out.seek(0,SEEK_SET) == 0);
+    off_t result = data_out.seek(0,SEEK_SET);
+    (void) result;
+    assert(result == 0);
     int len=0, curr=0; char buf;
     while( (curr=data_out.read(&buf, 1)) )
         len += curr;
 
     // write bits to sequence of bytes
     m_aBits.realloc(len);
-    assert(data_out.seek(0,SEEK_SET) == 0);
+    result = data_out.seek(0,SEEK_SET);
+    assert(result == 0);
     if( data_out.read(m_aBits.getArray(), len) != len )
         throw RuntimeException("The GpgME library failed to read the key");
 }
diff --git a/xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx b/xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx
index 5f9af66cfb8f..1667af6f59ad 100644
--- a/xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx
+++ b/xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx
@@ -212,7 +212,9 @@ SAL_CALL XMLSignature_GpgImpl::generate(
     rCtx.setArmor(false);
     GpgME::SigningResult sign_res=rCtx.sign(data_in, data_out,
                                             GpgME::Detached);
-    assert(data_out.seek(0,SEEK_SET) == 0);
+    off_t result = data_out.seek(0,SEEK_SET);
+    (void) result;
+    assert(result == 0);
     int len=0, curr=0; char buf;
     while( (curr=data_out.read(&buf, 1)) )
         len += curr;
@@ -224,7 +226,8 @@ SAL_CALL XMLSignature_GpgImpl::generate(
     xmlChar* signature = static_cast<xmlChar*>(xmlMalloc(len + 1));
     if(signature == nullptr)
         throw RuntimeException("The GpgME library failed to initialize for the OpenPGP protocol.");
-    assert(data_out.seek(0,SEEK_SET) == 0);
+    result = data_out.seek(0,SEEK_SET);
+    assert(result == 0);
     if( data_out.read(signature, len) != len )
         throw RuntimeException("The GpgME library failed to initialize for the OpenPGP protocol.");
 


More information about the Libreoffice-commits mailing list