diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-08-30 09:09:27 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-08-30 11:53:10 +0200 |
commit | 349c5cacedccbfbb71846ae3b276285d54c0d0b8 (patch) | |
tree | 032caa0b1ae5b3a84727f89dd21d50c5ced746c5 /sc | |
parent | 4099f7102a78f552eb85fadda7851db3c73b2d0f (diff) |
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 <caolanm@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/filter/lotus/lotimpop.cxx | 22 |
1 files changed, 12 insertions, 10 deletions
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() |