}
// Seek from the offset we got from the TGA header.
- stream.SeekI(offset, wxFromStart);
+ if (stream.SeekI(offset, wxFromStart) == wxInvalidOffset)
+ return wxTGA_INVFORMAT;
// Load a palette if we have one.
if (colorType == wxTGA_MAPPED)
{
// read the fixed-size TGA headers
unsigned char hdr[HDR_SIZE];
- stream.Read(hdr, HDR_SIZE);
+ stream.Read(hdr, HDR_SIZE); // it's ok to modify the stream position here
// Check wether we can read the file or not.