diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-11-16 13:14:36 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-11-16 15:22:11 +0100 |
commit | 359286b90f4d9962a3c1cb936ac7fd4140f71baa (patch) | |
tree | b851379d8ddf9b5861270ae907ba2ed305656025 /sot/source | |
parent | 49027122436dc061768e1e781d36755ff041d4a9 (diff) |
ofz#4079 check for error earlier
Change-Id: I141417811b0d64dbf1ad898f9f3a00e4e02d33c8
Reviewed-on: https://gerrit.libreoffice.org/44826
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sot/source')
-rw-r--r-- | sot/source/sdstor/stgelem.cxx | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sot/source/sdstor/stgelem.cxx b/sot/source/sdstor/stgelem.cxx index 7016a3a8f5f0..c474d5b3e100 100644 --- a/sot/source/sdstor/stgelem.cxx +++ b/sot/source/sdstor/stgelem.cxx @@ -136,7 +136,10 @@ bool StgHeader::Load( SvStream& r ) .ReadUInt16( m_nByteOrder ) // 1C Unicode byte order indicator .ReadInt16( m_nPageSize ) // 1E 1 << nPageSize = block size .ReadInt16( m_nDataPageSize ); // 20 1 << this size == data block size - r.SeekRel( 10 ); + if (!r.good()) + return false; + if (!checkSeek(r, r.Tell() + 10)) + return false; r.ReadInt32( m_nFATSize ) // 2C total number of FAT pages .ReadInt32( m_nTOCstrm ) // 30 starting page for the TOC stream .ReadInt32( m_nReserved ) // 34 @@ -148,7 +151,7 @@ bool StgHeader::Load( SvStream& r ) for(sal_Int32 & i : m_nMasterFAT) r.ReadInt32( i ); - return (r.GetErrorCode() == ERRCODE_NONE) && Check(); + return r.good() && Check(); } bool StgHeader::Store( StgIo& rIo ) |