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>
This commit is contained in:
Caolán McNamara 2021-08-31 09:37:31 +01:00
parent a41cbb1212
commit 3121616739
4 changed files with 10 additions and 5 deletions

View file

@ -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);

View file

@ -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()) );

View file

@ -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: */

View file

@ -90,6 +90,8 @@ LwpSvStream& LwpSvStream::ReadUInt32(sal_uInt32& rUInt32)
return *this;
}
bool LwpSvStream::good() const { return m_pStream->good(); }
/**
* @descr SeekRel in stream
*/