Reinforcing alignment to buffer size

This commit is contained in:
luigoalma 2020-03-07 22:35:16 +00:00 committed by Wolfvak
parent e763cbaf72
commit 6541e52f05

View File

@ -20,7 +20,7 @@ u64 IdentifyFileType(const char* path) {
const u8 png_magic[] = { PNG_MAGIC }; const u8 png_magic[] = { PNG_MAGIC };
if (!path) return 0; // safety if (!path) return 0; // safety
u8 ALIGN(32) header[0x2B8]; // minimum required size u8 ALIGN(32) header[0x2C0]; // minimum required size
void* data = (void*) header; void* data = (void*) header;
size_t fsize = FileGetSize(path); size_t fsize = FileGetSize(path);
char* fname = strrchr(path, '/'); char* fname = strrchr(path, '/');
@ -36,7 +36,7 @@ u64 IdentifyFileType(const char* path) {
} else { } else {
ext = ""; ext = "";
} }
if (FileGetData(path, header, 0x2B8, 0) < min(0x2B8, fsize)) return 0; if (FileGetData(path, header, 0x2C0, 0) < min(0x2C0, fsize)) return 0;
if (!fsize) return 0; if (!fsize) return 0;
if (fsize >= 0x200) { if (fsize >= 0x200) {