summaryrefslogtreecommitdiff
path: root/xmlsecurity
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2017-06-28 09:12:35 +0200
committerKatarina Behrens <Katarina.Behrens@cib.de>2017-06-28 17:25:13 +0200
commit4cdf803af7bc548cb614eb843ab216e264e485c9 (patch)
treec6b889e86e9add4cdf3ea2825f5f92515d26d08a /xmlsecurity
parentbd9fef1f6111577415e0716d680d6e714e0b5750 (diff)
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@libreoffice.org> Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> (cherry picked from commit 9a884b3d055ffdedbadb64c7f14e6d38078dedb1) Reviewed-on: https://gerrit.libreoffice.org/39353 Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
Diffstat (limited to 'xmlsecurity')
-rw-r--r--xmlsecurity/source/gpg/CertificateImpl.cxx7
-rw-r--r--xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx7
2 files changed, 10 insertions, 4 deletions
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.");