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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Fri Jun 11 12:43:21 UTC 2021


 sc/source/filter/excel/impop.cxx |   18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

New commits:
commit 8ce77cbd706ffd60dfcd79d82779025ef8d6782c
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Jun 11 11:06:11 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Jun 11 14:42:38 2021 +0200

    cid#1473844 Untrusted loop bound
    
    and
    
    cid#1474351 Untrusted loop bound
    cid#1474118 Untrusted loop bound
    
    this time without second guessing the original intent
    
    Change-Id: Iaa6b636a08ed29feaf709fbcbac7deac761a0fc7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117045
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sc/source/filter/excel/impop.cxx b/sc/source/filter/excel/impop.cxx
index 1c107d4ad092..988ec3fbf65e 100644
--- a/sc/source/filter/excel/impop.cxx
+++ b/sc/source/filter/excel/impop.cxx
@@ -878,8 +878,14 @@ void ImportExcel::Mulrk()
     XclAddress aXclPos;
     aIn >> aXclPos;
 
-    for( XclAddress aCurrXclPos( aXclPos ); (aXclPos.mnCol <= aCurrXclPos.mnCol) && (aIn.GetRecLeft() > 2); ++aCurrXclPos.mnCol )
+    XclAddress aCurrXclPos(aXclPos);
+    while (true)
     {
+        if (aXclPos.mnCol > aCurrXclPos.mnCol)
+            break;
+        if (aIn.GetRecLeft() <= 2)
+            break;
+
         sal_uInt16 nXF = aIn.ReaduInt16();
         sal_Int32 nRkNum = aIn.ReadInt32();
 
@@ -889,6 +895,7 @@ void ImportExcel::Mulrk()
             GetXFRangeBuffer().SetXF( aScPos, nXF );
             GetDocImport().setNumericCell(aScPos, XclTools::GetDoubleFromRK(nRkNum));
         }
+        ++aCurrXclPos.mnCol;
     }
 }
 
@@ -915,13 +922,20 @@ void ImportExcel::Mulblank()
     XclAddress aXclPos;
     aIn >> aXclPos;
 
-    for( XclAddress aCurrXclPos( aXclPos ); (aXclPos.mnCol <= aCurrXclPos.mnCol) && (aIn.GetRecLeft() > 2); ++aCurrXclPos.mnCol )
+    XclAddress aCurrXclPos(aXclPos);
+    while (true)
     {
+        if (aXclPos.mnCol > aCurrXclPos.mnCol)
+            break;
+        if (aIn.GetRecLeft() <= 2)
+            break;
+
         sal_uInt16 nXF = aIn.ReaduInt16();
 
         ScAddress aScPos( ScAddress::UNINITIALIZED );
         if( GetAddressConverter().ConvertAddress( aScPos, aCurrXclPos, GetCurrScTab(), true ) )
             GetXFRangeBuffer().SetBlankXF( aScPos, nXF );
+        ++aCurrXclPos.mnCol;
     }
 }
 


More information about the Libreoffice-commits mailing list