[Libreoffice-commits] core.git: lotuswordpro/inc lotuswordpro/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Tue Aug 31 18:36:17 UTC 2021
lotuswordpro/inc/lwpsvstream.hxx | 1 +
lotuswordpro/source/filter/lwpidxmgr.cxx | 10 ++++++----
lotuswordpro/source/filter/lwpobjhdr.cxx | 2 +-
lotuswordpro/source/filter/lwpsvstream.cxx | 2 ++
4 files changed, 10 insertions(+), 5 deletions(-)
New commits:
commit 312161673912bc60865493635f9820d11f2c58f3
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Aug 31 09:37:31 2021 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Aug 31 20:35:42 2021 +0200
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 at redhat.com>
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
*/
More information about the Libreoffice-commits
mailing list