X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8fee6306488bf6b2b4a730d15c8f300af9de470d..5d7792236f7e4fcbb94cdc2a5213e0c5788e8c28:/src/common/imagtga.cpp diff --git a/src/common/imagtga.cpp b/src/common/imagtga.cpp index fc7373822b..62080d22c1 100644 --- a/src/common/imagtga.cpp +++ b/src/common/imagtga.cpp @@ -211,7 +211,8 @@ int ReadTGA(wxImage* image, wxInputStream& stream) } // 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) @@ -668,7 +669,9 @@ bool wxTGAHandler::LoadFile(wxImage* image, if ( !CanRead(stream) ) { if ( verbose ) + { wxLogError(wxT("TGA: this is not a TGA file.")); + } return false; } @@ -740,7 +743,7 @@ bool wxTGAHandler::DoCanRead(wxInputStream& stream) { // 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.