sot/source/sdstor/stgole.cxx |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit ae5b06e346ca01bfbc0370632750e5a7c6154e46
Author:     Stephan Bergmann <[email protected]>
AuthorDate: Fri Jun 3 13:48:58 2022 +0200
Commit:     Stephan Bergmann <[email protected]>
CommitDate: Fri Jun 3 15:11:05 2022 +0200

    Use o3tl::make_unsigned, nStrLen is known to be non-negative here
    
    Change-Id: Ibb51c5b47edefe3f22a3d4335bc3136988c65486
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135355
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <[email protected]>

diff --git a/sot/source/sdstor/stgole.cxx b/sot/source/sdstor/stgole.cxx
index bee4feb8842d..ac23f7a14555 100644
--- a/sot/source/sdstor/stgole.cxx
+++ b/sot/source/sdstor/stgole.cxx
@@ -22,6 +22,7 @@
 
 #include "stgelem.hxx"
 #include "stgole.hxx"
+#include <o3tl/safeint.hxx>
 #include <sot/storinfo.hxx>
 
 ///////////////////////// class StgInternalStream
@@ -116,7 +117,7 @@ bool StgCompObjStream::Load()
 
             std::unique_ptr<char[]> p(new char[ nStrLen+1 ]);
             p[nStrLen] = 0;
-            if (static_cast<sal_Int32>(ReadBytes( p.get(), nStrLen )) == 
nStrLen)
+            if (ReadBytes( p.get(), nStrLen ) == o3tl::make_unsigned(nStrLen))
             {
                 //The encoding here is "ANSI", which is pretty useless seeing 
as
                 //the actual codepage used doesn't seem to be specified/stored

Reply via email to