Fix @revskills 0d27cc crash in bin.sms

This commit is contained in:
pancake 2015-11-04 19:32:57 +01:00
parent 065b887f79
commit f735557b4e

View File

@ -28,14 +28,16 @@ static int check(RBinFile *arch) {
#define CMP8(o,x) strncmp((const char*)bs+o,x,8)
#define CMP4(o,x) strncmp((const char*)bs+o,x,4)
static int check_bytes(const ut8 *bs, ut64 length) {
if (length > 0x2000) {
if (!CMP8(0x1ff0, "TMR SEGA") ||
!CMP8(0x3ff0, "TMR SEGA") ||
!CMP8(0x7ff0, "TMR SEGA") ||
!CMP8(0x8ff0, "TMR SEGA") ||
!CMP4(0x7fe0, "SDSC"))
return true;
}
if (length > 0x2000 && !CMP8(0x1ff0, "TMR SEGA"))
return true;
if (length > 0x4000 && !CMP8(0x3ff0, "TMR SEGA"))
return true;
if (length > 0x8000 && !CMP8(0x7ff0, "TMR SEGA"))
return true;
if (length > 0x9000 && !CMP8(0x8ff0, "TMR SEGA"))
return true;
if (length > 0x8000 && !CMP4(0x7fe0, "SDSC"))
return true;
return false;
}