summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-10-21 15:38:38 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-10-21 18:00:41 +0200
commit92c940a530c1b43ed1ba2ff10343024f2bf2d69b (patch)
treeff98a9e2788677ef9b7fb104cfdc8a57d21aef08 /sd
parentdc2b9e014ba81d6a244d0824e9c3b34fc38de884 (diff)
check seeks earlier
Change-Id: Id392f2299b6bdacb9a71e94959d24d02417d571e Reviewed-on: https://gerrit.libreoffice.org/43657 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sd')
-rw-r--r--sd/source/filter/ppt/propread.cxx17
1 files changed, 6 insertions, 11 deletions
diff --git a/sd/source/filter/ppt/propread.cxx b/sd/source/filter/ppt/propread.cxx
index e473e1566e31..ed1f9e4923d2 100644
--- a/sd/source/filter/ppt/propread.cxx
+++ b/sd/source/filter/ppt/propread.cxx
@@ -321,12 +321,8 @@ void Section::GetDictionary(Dictionary& rDict)
void Section::Read( SotStorageStream *pStrm )
{
- sal_uInt32 nSecOfs, nPropSize, nStrmSize;
- nSecOfs = pStrm->Tell();
-
- pStrm->Seek( STREAM_SEEK_TO_END );
- nStrmSize = pStrm->Tell();
- pStrm->Seek( nSecOfs );
+ sal_uInt32 nSecOfs = pStrm->Tell();
+ sal_uInt32 nStrmSize = pStrm->remainingSize();
mnTextEnc = RTL_TEXTENCODING_MS_1252;
sal_uInt32 nSecSize(0), nPropCount(0);
@@ -339,15 +335,14 @@ void Section::Read( SotStorageStream *pStrm )
break;
auto nCurrent = pStrm->Tell();
sal_uInt64 nOffset = nPropOfs + nSecOfs;
- if (nOffset != pStrm->Seek(nOffset))
+ if (!checkSeek(*pStrm, nOffset))
break;
if ( nPropId ) // do not read dictionary
{
sal_uInt32 nPropType(0), nVectorCount(0);
pStrm->ReadUInt32(nPropType);
- nPropSize = 4;
-
+ sal_uInt32 nPropSize = 4;
if ( nPropType & VT_VECTOR )
{
pStrm->ReadUInt32( nVectorCount );
@@ -436,7 +431,7 @@ void Section::Read( SotStorageStream *pStrm )
if ( ( nVectorCount - i ) > 1 )
{
nOffset = nPropOfs + nSecOfs + nPropSize;
- if (nOffset != pStrm->Seek(nOffset))
+ if (!checkSeek(*pStrm, nOffset))
break;
}
}
@@ -503,7 +498,7 @@ void Section::Read( SotStorageStream *pStrm )
if (!pStrm->good())
break;
sal_uInt64 nPos = pStrm->Tell() + nSize;
- if (nPos != pStrm->Seek(nPos))
+ if (!checkSeek(*pStrm, nPos))
break;
}
sal_uInt32 nSize = pStrm->Tell();