[Libreoffice-commits] .: binfilter/bf_svtools
Caolán McNamara
caolan at kemper.freedesktop.org
Mon Oct 17 01:29:03 PDT 2011
binfilter/bf_svtools/source/filerec/svt_filerec.cxx | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
New commits:
commit 558ce7360fdcf15b74da7bd6d76e4075a4441f11
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sat Oct 15 14:39:30 2011 +0100
check for short and busted streams and initialize values
diff --git a/binfilter/bf_svtools/source/filerec/svt_filerec.cxx b/binfilter/bf_svtools/source/filerec/svt_filerec.cxx
index 1ff9c05..9f6b74f 100644
--- a/binfilter/bf_svtools/source/filerec/svt_filerec.cxx
+++ b/binfilter/bf_svtools/source/filerec/svt_filerec.cxx
@@ -157,14 +157,14 @@ SfxMiniRecordReader::SfxMiniRecordReader
{
// Header lesen
DBG( DbgOutf( "SfxFileRec: searching record at %ul", pStream->Tell() ) );
- UINT32 nHeader;
+ UINT32 nHeader(0);
*pStream >> nHeader;
// Headerdaten von Basisklasse extrahieren lassen
SetHeader_Impl( nHeader );
// ggf. Fehler behandeln
- if ( pStream->IsEof() )
+ if ( !pStream->good() )
_nPreTag = SFX_REC_PRETAG_EOR;
else if ( _nPreTag == SFX_REC_PRETAG_EOR )
pStream->SetError( ERRCODE_IO_WRONGFORMAT );
@@ -201,7 +201,7 @@ inline bool SfxSingleRecordReader::ReadHeader_Impl( USHORT nTypes )
bool bRet;
// Basisklassen-Header einlesen
- UINT32 nHeader=0;
+ UINT32 nHeader(0);
*_pStream >> nHeader;
if ( !SetHeader_Impl( nHeader ) )
bRet = FALSE;
@@ -259,13 +259,13 @@ bool SfxSingleRecordReader::FindHeader_Impl
UINT32 nStartPos = _pStream->Tell();
// richtigen Record suchen
- while ( !_pStream->IsEof() )
+ while ( _pStream->good() )
{
// Header lesen
- UINT32 nHeader;
+ UINT32 nHeader(0);
DBG( DbgOutf( "SfxFileRec: searching record at %ul", _pStream->Tell() ) );
*_pStream >> nHeader;
- if ( !SetHeader_Impl( nHeader ) )
+ if ( !_pStream->good() || !SetHeader_Impl( nHeader ) )
// EOR => Such-Schleife abbreichen
break;
@@ -274,6 +274,8 @@ bool SfxSingleRecordReader::FindHeader_Impl
{
// Extended Header lesen
*_pStream >> nHeader;
+ if ( !_pStream->good() )
+ break;
_nRecordTag = sal::static_int_cast< UINT16 >(SFX_REC_TAG(nHeader));
// richtigen Record gefunden?
@@ -292,7 +294,7 @@ bool SfxSingleRecordReader::FindHeader_Impl
}
// sonst skippen
- if ( !_pStream->IsEof() )
+ if ( _pStream->good() )
_pStream->Seek( _nEofRec );
}
More information about the Libreoffice-commits
mailing list