diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2022-06-01 09:09:46 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2022-06-01 10:49:20 +0200 |
commit | e89e3a8b5a7639f14833d066e8a6c445dca97cc0 (patch) | |
tree | 6cabe68756d6491658a7789deca6f0a3e3afdc16 /sot | |
parent | 6dbccf3d9344be0c2ba162a8df5fc0bf425cb84e (diff) |
The return value of those getLength functions is guaranteed to be non-negative
...so use o3tl::make_unsigned when comparing it against an expression of
unsigned integer type, instead of casting that expression to a signed type
Change-Id: Ic47c6d96919b2aba2d16ce6d1a2a8e4c5761a480
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135219
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sot')
-rw-r--r-- | sot/source/sdstor/ucbstorage.cxx | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx index f478173d5dc5..4e2dc1a2a6ea 100644 --- a/sot/source/sdstor/ucbstorage.cxx +++ b/sot/source/sdstor/ucbstorage.cxx @@ -43,6 +43,7 @@ #include <memory> #include <optional> +#include <o3tl/safeint.hxx> #include <osl/diagnose.h> #include <osl/file.hxx> #include <sal/log.hxx> @@ -157,7 +158,7 @@ sal_Int32 SAL_CALL FileStreamWrapper_Impl::readBytes(Sequence< sal_Int8 >& aData checkError(); // if read characters < MaxLength, adjust sequence - if (static_cast<sal_Int32>(nRead) < aData.getLength()) + if (nRead < o3tl::make_unsigned(aData.getLength())) aData.realloc( nRead ); return nRead; |