[Libreoffice-commits] core.git: sal/rtl
Stephan Bergmann (via logerrit)
logerrit at kemper.freedesktop.org
Tue Jan 28 16:16:32 UTC 2020
sal/rtl/cipher.cxx | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
New commits:
commit 28f66527c5fc5325582e8b716481584a9f711815
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Tue Jan 28 13:53:53 2020 +0100
Commit: Stephan Bergmann <sbergman at redhat.com>
CommitDate: Tue Jan 28 17:16:00 2020 +0100
loplugin:unsignedcompare (--enable-cipher-openssl-backend)
Change-Id: Iab5ab11059437a595596e8ba3ec7aa45cec15f0d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87617
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/sal/rtl/cipher.cxx b/sal/rtl/cipher.cxx
index 9bc438114651..be69d045a0ec 100644
--- a/sal/rtl/cipher.cxx
+++ b/sal/rtl/cipher.cxx
@@ -19,6 +19,7 @@
#include <string.h>
+#include <o3tl/safeint.hxx>
#include <sal/types.h>
#include <rtl/alloc.h>
#include <rtl/cipher.h>
@@ -725,7 +726,7 @@ static rtlCipherError BF_update(
assert(eMode == rtl_Cipher_ModeStream);
(void) eMode;
(void) eDirection;
- while (nDatLen > static_cast<unsigned int>(std::numeric_limits<int>::max())) {
+ while (nDatLen > o3tl::make_unsigned(std::numeric_limits<int>::max())) {
int outl;
if (EVP_CipherUpdate(ctx->m_context, pBuffer, &outl, pData, std::numeric_limits<int>::max())
== 0)
@@ -1051,7 +1052,7 @@ rtlCipherError SAL_CALL rtl_cipher_initBF(
// Cannot easily support DirectionBoth, and it isn't used in the LO code at least:
return rtl_Cipher_E_Direction;
}
- if (nKeyLen > static_cast<unsigned int>(std::numeric_limits<int>::max())) {
+ if (nKeyLen > o3tl::make_unsigned(std::numeric_limits<int>::max())) {
return rtl_Cipher_E_BufferSize;
}
if (pImpl->m_context.m_context != nullptr) {
@@ -1188,7 +1189,7 @@ static rtlCipherError rtl_cipherARCFOUR_init_Impl(
const sal_uInt8 *pKeyData, sal_Size nKeyLen)
{
#if defined LIBO_CIPHER_OPENSSL_BACKEND
- if (nKeyLen > static_cast<unsigned int>(std::numeric_limits<int>::max())) {
+ if (nKeyLen > o3tl::make_unsigned(std::numeric_limits<int>::max())) {
return rtl_Cipher_E_BufferSize;
}
if (ctx->m_context != nullptr) {
@@ -1268,7 +1269,7 @@ static rtlCipherError rtl_cipherARCFOUR_update_Impl(
return rtl_Cipher_E_BufferSize;
#if defined LIBO_CIPHER_OPENSSL_BACKEND
- while (nDatLen > static_cast<unsigned int>(std::numeric_limits<int>::max())) {
+ while (nDatLen > o3tl::make_unsigned(std::numeric_limits<int>::max())) {
int outl;
if (EVP_CipherUpdate(ctx->m_context, pBuffer, &outl, pData, std::numeric_limits<int>::max())
== 0)
More information about the Libreoffice-commits
mailing list