summaryrefslogtreecommitdiff
path: root/lotuswordpro
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-08-31 09:37:31 +0100
committerCaolán McNamara <caolanm@redhat.com>2021-08-31 20:35:42 +0200
commit312161673912bc60865493635f9820d11f2c58f3 (patch)
tree40880dcff5c569402e02ddd3c684f5218d5813df /lotuswordpro
parenta41cbb1212a92f525dc75e90007c6dbc998f37c5 (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')
-rw-r--r--lotuswordpro/inc/lwpsvstream.hxx1
-rw-r--r--lotuswordpro/source/filter/lwpidxmgr.cxx10
-rw-r--r--lotuswordpro/source/filter/lwpobjhdr.cxx2
-rw-r--r--lotuswordpro/source/filter/lwpsvstream.cxx2
4 files changed, 10 insertions, 5 deletions
diff --git a/lotuswordpro/inc/lwpsvstream.hxx b/lotuswordpro/inc/lwpsvstream.hxx
index a962f6e599d6..3cca958bb142 100644
--- a/lotuswordpro/inc/lwpsvstream.hxx
+++ b/lotuswordpro/inc/lwpsvstream.hxx
@@ -75,6 +75,7 @@ public:
sal_uInt64 remainingSize();
sal_Int64 Seek(sal_Int64 pos);
bool CheckSeek(sal_Int64 pos);
+ bool good() const;
LwpSvStream& ReadUInt8(sal_uInt8& rUInt8);
LwpSvStream& ReadUInt16(sal_uInt16& rUInt16);
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
*/