diff --git a/xmlsecurity/source/helper/documentsignaturehelper.cxx b/xmlsecurity/source/helper/documentsignaturehelper.cxx index e3908fc5ee76..ca4446bdf740 100644 --- a/xmlsecurity/source/helper/documentsignaturehelper.cxx +++ b/xmlsecurity/source/helper/documentsignaturehelper.cxx @@ -371,7 +371,7 @@ SignatureStreamHelper DocumentSignatureHelper::OpenSignatureStream( sal_Int64 nSize = 0; uno::Reference xPropertySet(xInputStream, uno::UNO_QUERY); xPropertySet->getPropertyValue(u"Size"_ustr) >>= nSize; - if (nSize >= 0 || nSize < SAL_MAX_INT32) + if (nSize >= 0 && nSize < SAL_MAX_INT32) { uno::Sequence aData; xInputStream->readBytes(aData, nSize);