[Libreoffice-commits] core.git: sc/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Thu Nov 14 21:27:33 UTC 2019


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

New commits:
commit 8c85782bbe46963e2be32c3cb406982f1790fc2f
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Nov 14 13:47:15 2019 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Nov 14 22:26:15 2019 +0100

    coverity#1242892 Untrusted value as argument
    
    Change-Id: Ia4fd0a270d42fc2da233da18d4122f786c79dc3d
    Reviewed-on: https://gerrit.libreoffice.org/82697
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sc/source/filter/excel/xistream.cxx b/sc/source/filter/excel/xistream.cxx
index f7427b9295ed..a0293e69dd6e 100644
--- a/sc/source/filter/excel/xistream.cxx
+++ b/sc/source/filter/excel/xistream.cxx
@@ -831,7 +831,7 @@ std::size_t XclImpStream::ReadUniStringExtHeader( bool& rb16Bit, sal_uInt8 nFlag
 
 OUString XclImpStream::ReadRawUniString( sal_uInt16 nChars, bool b16Bit )
 {
-    OUStringBuffer aRet(nChars);
+    OUStringBuffer aRet(std::min<sal_uInt16>(nChars, mnRawRecLeft / (b16Bit ? 2 : 1)));
     sal_uInt16 nCharsLeft = nChars;
     sal_uInt16 nReadSize;
 
@@ -839,7 +839,7 @@ OUString XclImpStream::ReadRawUniString( sal_uInt16 nChars, bool b16Bit )
     {
         if( b16Bit )
         {
-            nReadSize = ::std::min< sal_uInt16 >( nCharsLeft, mnRawRecLeft / 2 );
+            nReadSize = std::min<sal_uInt16>(nCharsLeft, mnRawRecLeft / 2);
             OSL_ENSURE( (nReadSize <= nCharsLeft) || !(mnRawRecLeft & 0x1),
                 "XclImpStream::ReadRawUniString - missing a byte" );
         }


More information about the Libreoffice-commits mailing list