From 359286b90f4d9962a3c1cb936ac7fd4140f71baa Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 16 Nov 2017 13:14:36 +0000 Subject: ofz#4079 check for error earlier MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I141417811b0d64dbf1ad898f9f3a00e4e02d33c8 Reviewed-on: https://gerrit.libreoffice.org/44826 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- sot/source/sdstor/stgelem.cxx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'sot') 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 ) -- cgit v1.2.3