diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-08-31 09:37:31 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-08-31 20:35:42 +0200 |
commit | 312161673912bc60865493635f9820d11f2c58f3 (patch) | |
tree | 40880dcff5c569402e02ddd3c684f5218d5813df /lotuswordpro/source | |
parent | a41cbb1212a92f525dc75e90007c6dbc998f37c5 (diff) |
ofz: MemorySanitizer: use-of-uninitialized-value
Change-Id: I4298dfeafab0fe296a970fce024cc25572e3a2b4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121388
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'lotuswordpro/source')
-rw-r--r-- | lotuswordpro/source/filter/lwpidxmgr.cxx | 10 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwpobjhdr.cxx | 2 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwpsvstream.cxx | 2 |
3 files changed, 9 insertions, 5 deletions
diff --git a/lotuswordpro/source/filter/lwpidxmgr.cxx b/lotuswordpro/source/filter/lwpidxmgr.cxx index 504533fb27cc..e9f34bf956d1 100644 --- a/lotuswordpro/source/filter/lwpidxmgr.cxx +++ b/lotuswordpro/source/filter/lwpidxmgr.cxx @@ -88,7 +88,8 @@ void LwpIndexManager::Read(LwpSvStream* pStrm) { //Read index obj LwpObjectHeader ObjHdr; - ObjHdr.Read(*pStrm); + if (!ObjHdr.Read(*pStrm)) + throw BadRead(); std::unique_ptr<LwpObjectStream> xObjStrm(new LwpObjectStream(pStrm, ObjHdr.IsCompressed(), static_cast<sal_uInt16>(ObjHdr.GetSize()))); @@ -224,9 +225,9 @@ void LwpIndexManager::ReadObjIndexData(LwpObjectStream* pObjStrm) */ void LwpIndexManager::ReadObjIndex( LwpSvStream *pStrm ) { - LwpObjectHeader ObjHdr; - ObjHdr.Read(*pStrm); + if (!ObjHdr.Read(*pStrm)) + throw BadRead(); LwpObjectStream aObjStrm(pStrm, ObjHdr.IsCompressed(), static_cast<sal_uInt16>(ObjHdr.GetSize()) ); @@ -246,7 +247,8 @@ void LwpIndexManager::ReadObjIndex( LwpSvStream *pStrm ) void LwpIndexManager::ReadLeafIndex( LwpSvStream *pStrm ) { LwpObjectHeader ObjHdr; - ObjHdr.Read(*pStrm); + if (!ObjHdr.Read(*pStrm)) + throw BadRead(); LwpObjectStream aObjStrm( pStrm, ObjHdr.IsCompressed(), static_cast<sal_uInt16>(ObjHdr.GetSize()) ); diff --git a/lotuswordpro/source/filter/lwpobjhdr.cxx b/lotuswordpro/source/filter/lwpobjhdr.cxx index aeb5c895fc11..37e3e077eaa3 100644 --- a/lotuswordpro/source/filter/lwpobjhdr.cxx +++ b/lotuswordpro/source/filter/lwpobjhdr.cxx @@ -195,7 +195,7 @@ bool LwpObjectHeader::Read(LwpSvStream& rStrm) } } sal_Int64 nEndPos = rStrm.Tell(); - return (nStartPos + nHeaderSize == nEndPos); + return rStrm.good() && (nStartPos + nHeaderSize == nEndPos); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/lwpsvstream.cxx b/lotuswordpro/source/filter/lwpsvstream.cxx index dfd18168a728..7e485014c2de 100644 --- a/lotuswordpro/source/filter/lwpsvstream.cxx +++ b/lotuswordpro/source/filter/lwpsvstream.cxx @@ -90,6 +90,8 @@ LwpSvStream& LwpSvStream::ReadUInt32(sal_uInt32& rUInt32) return *this; } +bool LwpSvStream::good() const { return m_pStream->good(); } + /** * @descr SeekRel in stream */ |