Fix CImageLoaderJPG::isALoadableFileFormat according to upstream

This commit is contained in:
Benau 2022-08-09 10:20:04 +08:00
parent 1b42688cbf
commit ed4dcc24c6

View File

@ -120,14 +120,11 @@ bool CImageLoaderJPG::isALoadableFileFormat(io::IReadFile* file) const
return false; return false;
#else #else
if (!file) if (!(file && file->seek(0)))
return false; return false;
unsigned char header[3];
s32 jfif = 0; size_t headerLen = file->read(header, sizeof(header));
file->seek(6); return headerLen >= 3 && !memcmp(header, "\xFF\xD8\xFF", 3);
file->read(&jfif, sizeof(s32));
return (jfif == 0x4a464946 || jfif == 0x4649464a);
#endif #endif
} }