comphelper/source/streaming/memorystream.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
New commits: commit 74fe9be6fda68d331d73f4331f670d1a24964505 Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Thu Jun 2 18:46:09 2022 +0200 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Thu Jun 2 20:37:13 2022 +0200 Use o3tl::make_unsigned, location is already checked to be non-negative here Change-Id: Id052b9628e8df6d0e8b61b66f6ddc64d925427ad Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135321 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/comphelper/source/streaming/memorystream.cxx b/comphelper/source/streaming/memorystream.cxx index 98431e318380..8bf3c3e90f5c 100644 --- a/comphelper/source/streaming/memorystream.cxx +++ b/comphelper/source/streaming/memorystream.cxx @@ -33,6 +33,7 @@ #include <comphelper/bytereader.hxx> #include <cppuhelper/implbase.hxx> #include <cppuhelper/supportsservice.hxx> +#include <o3tl/safeint.hxx> #include <osl/diagnose.h> #include <string.h> @@ -185,7 +186,7 @@ void SAL_CALL UNOMemoryStream::seek( sal_Int64 location ) throw IllegalArgumentException("this implementation does not support more than 2GB!", static_cast<OWeakObject*>(this), 0 ); // seek operation should be able to resize the stream - if ( location > static_cast< sal_Int64 >( maData.size() ) ) + if ( o3tl::make_unsigned(location) > maData.size() ) maData.resize( static_cast< sal_Int32 >( location ) ); mnCursor = static_cast< sal_Int32 >( location );