X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8fee6306488bf6b2b4a730d15c8f300af9de470d..c753eb9269d1e6c99b80a2d782ce49d9864ac1da:/src/common/imagtga.cpp diff --git a/src/common/imagtga.cpp b/src/common/imagtga.cpp index fc7373822b..d98ff01800 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) @@ -740,7 +741,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.