Kaydet (Commit) 46c0b087 authored tarafından Caolán McNamara's avatar Caolán McNamara Kaydeden (comit) Andras Timar

check stream status

Change-Id: I6b9537cf94ac1c5d996ba64ddf878745dadde254
(cherry picked from commit 452cd9e7)
Reviewed-on: https://gerrit.libreoffice.org/18128Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
üst c38ce978
...@@ -497,10 +497,18 @@ void Section::Read( SotStorageStream *pStrm ) ...@@ -497,10 +497,18 @@ void Section::Read( SotStorageStream *pStrm )
{ {
sal_uInt32 nDictCount(0); sal_uInt32 nDictCount(0);
pStrm->ReadUInt32(nDictCount); pStrm->ReadUInt32(nDictCount);
auto nMaxRecordsPossible = pStrm->remainingSize() / (sizeof(sal_uInt32)*2);
if (nDictCount > nMaxRecordsPossible)
{
SAL_WARN("sd.filter", "Dictionary count of " << nDictCount << " claimed, only " << nMaxRecordsPossible << " possible");
nDictCount = nMaxRecordsPossible;
}
for (sal_uInt32 i = 0; i < nDictCount; ++i) for (sal_uInt32 i = 0; i < nDictCount; ++i)
{ {
sal_uInt32 nSize(0); sal_uInt32 nSize(0);
pStrm->ReadUInt32( nSize ).ReadUInt32( nSize ); pStrm->ReadUInt32( nSize ).ReadUInt32( nSize );
if (!pStrm->good())
break;
sal_uInt64 nPos = pStrm->Tell() + nSize; sal_uInt64 nPos = pStrm->Tell() + nSize;
if (nPos != pStrm->Seek(nPos)) if (nPos != pStrm->Seek(nPos))
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment