Added support for calling throwException() from InputIterator and added a check for negative string sizes.
This commit is contained in:
@@ -692,6 +692,8 @@ InputStream::ReadType InputStream::start( InputIterator* inIterator )
|
||||
if ( !_in )
|
||||
throwException( "InputStream: Null stream specified." );
|
||||
if ( getException() ) return type;
|
||||
|
||||
_in->setInputStream(this);
|
||||
|
||||
// Check OSG header information
|
||||
unsigned int version = 0;
|
||||
|
||||
@@ -145,11 +145,15 @@ public:
|
||||
virtual void readString( std::string& s )
|
||||
{
|
||||
int size = 0; readInt( size );
|
||||
if ( size )
|
||||
if ( size>0 )
|
||||
{
|
||||
s.resize( size );
|
||||
_in->read( (char*)s.c_str(), size );
|
||||
}
|
||||
else if ( size<0 )
|
||||
{
|
||||
throwException( "InputStream::readString() error, negative string size read." );
|
||||
}
|
||||
}
|
||||
|
||||
virtual void readStream( std::istream& (*fn)(std::istream&) ) {}
|
||||
|
||||
Reference in New Issue
Block a user