sc/source/filter/qpro/qpro.cxx |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit e4b1ba9447a0a56aa56400f9f44d8eecb6c11e9c
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Fri Sep 3 09:22:23 2021 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Fri Sep 3 15:49:19 2021 +0200

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

diff --git a/sc/source/filter/qpro/qpro.cxx b/sc/source/filter/qpro/qpro.cxx
index 7bb6c82b5611..5ee451af9aef 100644
--- a/sc/source/filter/qpro/qpro.cxx
+++ b/sc/source/filter/qpro/qpro.cxx
@@ -51,7 +51,9 @@ ErrCode ScQProReader::readSheet( SCTAB nTab, ScDocument& 
rDoc, ScQProStyle *pSty
             case 0x000f:{ // Label cell
                 mpStream->ReadUChar( nCol ).ReadUChar( nDummy ).ReadUInt16( 
nRow ).ReadUInt16( nStyle ).ReadUChar( nDummy );
                 sal_uInt16 nLen = getLength();
-                if (nLen >= 7)
+                if (!mpStream->good() || nLen < 7)
+                    eRet = SCERR_IMPORT_FORMAT;
+                else
                 {
                     OUString aLabel(readString(nLen - 7));
                     nStyle = nStyle >> 3;
@@ -59,8 +61,6 @@ ErrCode ScQProReader::readSheet( SCTAB nTab, ScDocument& 
rDoc, ScQProStyle *pSty
                     rDoc.EnsureTable(nTab);
                     rDoc.SetTextCell(ScAddress(nCol,nRow,nTab), aLabel);
                 }
-                else
-                    eRet = SCERR_IMPORT_FORMAT;
                 }
                 break;
 

Reply via email to