wxInt32 anih32;
memcpy( &anih32, "anih", 4 );
+ if ( stream.SeekI(0) == wxInvalidOffset )
+ {
+ return false;
+ }
+
if ( !stream.Read(&FCC1, 4) )
return false;
wxInt32 seq32;
memcpy( &seq32, "seq ", 4 );
+ if ( stream.SeekI(0) == wxInvalidOffset)
+ {
+ return false;
+ }
+
if ( !stream.Read(&FCC1, 4) )
return false;
if ( FCC1 != riff32 )
bool wxICOHandler::LoadFile(wxImage *image, wxInputStream& stream,
bool verbose, int index)
{
+ if (stream.SeekI(0) == wxInvalidOffset)
+ {
+ return false;
+ }
+
return DoLoadFile(image, stream, verbose, index);
}
int wxICOHandler::DoGetImageCount(wxInputStream& stream)
{
+ // It's ok to modify the stream position in this function.
+
+ if (stream.SeekI(0) == wxInvalidOffset)
+ {
+ return 0;
+ }
+
ICONDIR IconDir;
if (stream.Read(&IconDir, sizeof(IconDir)).LastRead() != sizeof(IconDir))
- // it's ok to modify the stream position here
return 0;
return (int)wxUINT16_SWAP_ON_BE(IconDir.idCount);
static bool CanReadICOOrCUR(wxInputStream *stream, wxUint16 resourceType)
{
+ // It's ok to modify the stream position in this function.
+
+ if ( stream->SeekI(0) == wxInvalidOffset)
+ {
+ return false;
+ }
+
ICONDIR iconDir;
- if ( !stream->Read(&iconDir, sizeof(iconDir)) ) // it's ok to modify the stream position here
+ if ( !stream->Read(&iconDir, sizeof(iconDir)) )
{
return false;
}