sc/source/filter/excel/xistream.cxx |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

New commits:
commit 6fbc612c1f32d1f12a1f33feb3ef08520ef5a91e
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Thu Mar 25 13:18:21 2021 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Thu Mar 25 15:46:59 2021 +0100

    cid#1448242 silence bogus Untrusted allocation size
    
    Change-Id: Ieb157af917d1a8745ca91d3cd6c54b2b7119a3fa
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113097
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sc/source/filter/excel/xistream.cxx 
b/sc/source/filter/excel/xistream.cxx
index 7cf5d972e401..f1ae53dcbd6c 100644
--- a/sc/source/filter/excel/xistream.cxx
+++ b/sc/source/filter/excel/xistream.cxx
@@ -19,6 +19,7 @@
 
 #include <comphelper/docpasswordhelper.hxx>
 #include <comphelper/sequenceashashmap.hxx>
+#include <o3tl/safeint.hxx>
 #include <osl/thread.h>
 #include <osl/diagnose.h>
 #include <sal/log.hxx>
@@ -831,7 +832,7 @@ std::size_t XclImpStream::ReadUniStringExtHeader( bool& 
rb16Bit, sal_uInt8 nFlag
 
 OUString XclImpStream::ReadRawUniString( sal_uInt16 nChars, bool b16Bit )
 {
-    OUStringBuffer aRet(std::min<sal_uInt16>(nChars, mnRawRecLeft / (b16Bit ? 
2 : 1)));
+    OUStringBuffer aRet(o3tl::sanitizing_min<sal_uInt16>(nChars, mnRawRecLeft 
/ (b16Bit ? 2 : 1)));
     sal_uInt16 nCharsLeft = nChars;
     sal_uInt16 nReadSize;
 
@@ -839,7 +840,7 @@ OUString XclImpStream::ReadRawUniString( sal_uInt16 nChars, 
bool b16Bit )
     {
         if( b16Bit )
         {
-            nReadSize = std::min<sal_uInt16>(nCharsLeft, mnRawRecLeft / 2);
+            nReadSize = o3tl::sanitizing_min<sal_uInt16>(nCharsLeft, 
mnRawRecLeft / 2);
             OSL_ENSURE( (nReadSize <= nCharsLeft) || !(mnRawRecLeft & 0x1),
                 "XclImpStream::ReadRawUniString - missing a byte" );
         }
@@ -911,7 +912,7 @@ void XclImpStream::IgnoreRawUniString( sal_uInt16 nChars, 
bool b16Bit )
     {
         if( b16Bit )
         {
-            nReadSize = ::std::min< sal_uInt16 >( nCharsLeft, mnRawRecLeft / 2 
);
+            nReadSize = o3tl::sanitizing_min<sal_uInt16>(nCharsLeft, 
mnRawRecLeft / 2);
             OSL_ENSURE( (nReadSize <= nCharsLeft) || !(mnRawRecLeft & 0x1),
                 "XclImpStream::IgnoreRawUniString - missing a byte" );
             Ignore( nReadSize * 2 );
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to