sc/source/filter/lotus/lotimpop.cxx |   22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

New commits:
commit 349c5cacedccbfbb71846ae3b276285d54c0d0b8
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Mon Aug 30 09:09:27 2021 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Mon Aug 30 11:53:10 2021 +0200

    ofz: MemorySanitizer: use-of-uninitialized-value
    
    Change-Id: I7e52d33f0e94f4bad03e9e3881b54e90172e12a7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121263
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sc/source/filter/lotus/lotimpop.cxx 
b/sc/source/filter/lotus/lotimpop.cxx
index 38a0337a9d25..9b3852f05a36 100644
--- a/sc/source/filter/lotus/lotimpop.cxx
+++ b/sc/source/filter/lotus/lotimpop.cxx
@@ -99,9 +99,9 @@ void ImportLotus::Columnwidth( sal_uInt16 nRecLen )
 {
     SAL_WARN_IF( nRecLen < 4, "sc.filter", "*ImportLotus::Columnwidth(): 
Record too short!" );
 
-    sal_uInt8    nLTab, nWindow2;
-    sal_uInt16    nCnt = (nRecLen < 4) ? 0 : ( nRecLen - 4 ) / 2;
+    sal_uInt16 nCnt = (nRecLen < 4) ? 0 : ( nRecLen - 4 ) / 2;
 
+    sal_uInt8 nLTab(0), nWindow2(0);
     Read( nLTab );
     Read( nWindow2 );
 
@@ -113,10 +113,9 @@ void ImportLotus::Columnwidth( sal_uInt16 nRecLen )
 
     Skip( 2 );
 
-    sal_uInt8   nCol, nSpaces;
-
-    while( nCnt )
+    while (nCnt && !pIn->good())
     {
+        sal_uInt8 nCol(0), nSpaces(0);
         Read( nCol );
         Read( nSpaces );
         // Attention: ambiguous Correction factor!
@@ -124,15 +123,17 @@ void ImportLotus::Columnwidth( sal_uInt16 nRecLen )
 
         nCnt--;
     }
+
+    SAL_WARN_IF(!pIn->good(), "sc.filter", "*ImportLotus::Columnwidth(): short 
read");
 }
 
 void ImportLotus::Hiddencolumn( sal_uInt16 nRecLen )
 {
     SAL_WARN_IF( nRecLen < 4, "sc.filter", "*ImportLotus::Hiddencolumn(): 
Record too short!" );
 
-    sal_uInt8    nLTab, nWindow2;
-    sal_uInt16    nCnt = (nRecLen < 4) ? 0 : ( nRecLen - 4 ) / 2;
+    sal_uInt16 nCnt = (nRecLen < 4) ? 0 : ( nRecLen - 4 ) / 2;
 
+    sal_uInt8 nLTab(0), nWindow2(0);
     Read( nLTab );
     Read( nWindow2 );
 
@@ -141,15 +142,16 @@ void ImportLotus::Hiddencolumn( sal_uInt16 nRecLen )
 
     Skip( 2 );
 
-    sal_uInt8   nCol;
-
-    while( nCnt )
+    while (nCnt && !pIn->good())
     {
+        sal_uInt8 nCol(0);
         Read( nCol );
 
         rD.SetColHidden(static_cast<SCCOL>(nCol), static_cast<SCCOL>(nCol), 
static_cast<SCTAB>(nLTab), true);
         nCnt--;
     }
+
+    SAL_WARN_IF(!pIn->good(), "sc.filter", "*ImportLotus::Hiddencolumn(): 
short read");
 }
 
 void ImportLotus::Userrange()

Reply via email to