]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/xpmdecod.cpp
applying patch, fixes #10523
[wxWidgets.git] / src / common / xpmdecod.cpp
index ae43e513fdee898bf755fcf10166d3f7a27901c6..54e54c5221e5aeabe90011754f6e19d01793b815 100644 (file)
@@ -108,6 +108,7 @@ license is as follows:
     #include "wx/hashmap.h"
     #include "wx/stream.h"
     #include "wx/image.h"
     #include "wx/hashmap.h"
     #include "wx/stream.h"
     #include "wx/image.h"
+    #include "wx/palette.h"
 #endif
 
 #include <string.h>
 #endif
 
 #include <string.h>
@@ -121,7 +122,8 @@ bool wxXPMDecoder::CanRead(wxInputStream& stream)
     if ( !stream.Read(buf, WXSIZEOF(buf)) )
         return false;
 
     if ( !stream.Read(buf, WXSIZEOF(buf)) )
         return false;
 
-    stream.SeekI(-(wxFileOffset)WXSIZEOF(buf), wxFromCurrent);
+    if (stream.SeekI(-(wxFileOffset)WXSIZEOF(buf), wxFromCurrent) == wxInvalidOffset)
+        return false;
 
     return memcmp(buf, "/* XPM */", WXSIZEOF(buf)) == 0;
 }
 
     return memcmp(buf, "/* XPM */", WXSIZEOF(buf)) == 0;
 }