{
while ((i = (unsigned char)stream.GetC()) != 0)
{
- stream.SeekI(i, wxFromCurrent);
- if (stream.Eof())
+ if (stream.Eof() || (stream.LastRead() == 0))
{
done = true;
break;
}
+ stream.SeekI(i, wxFromCurrent);
}
}
}
/* skip all data */
while ((i = (unsigned char)stream.GetC()) != 0)
{
+ if (stream.Eof() || (stream.LastRead() == 0))
+ {
+ Destroy();
+ return wxGIF_INVFORMAT;
+ }
stream.SeekI(i, wxFromCurrent);
}
}
wxFileOffset pos = stream.TellI();
wxFileOffset numBytes = 3 * local_ncolors;
stream.SeekI(numBytes, wxFromCurrent);
- if (stream.TellI() != (pos + numBytes))
- {
- Destroy();
- return wxGIF_INVFORMAT;
- }
}
/* initial code size */
(void) stream.GetC();
+ if (stream.Eof() || (stream.LastRead() == 0))
+ {
+ Destroy();
+ return wxGIF_INVFORMAT;
+ }
/* skip all data */
while ((i = (unsigned char)stream.GetC()) != 0)
{
+ if (stream.Eof() || (stream.LastRead() == 0))
+ {
+ Destroy();
+ return wxGIF_INVFORMAT;
+ }
stream.SeekI(i, wxFromCurrent);
}
}