Atrac buffer validate RIFF header

This commit is contained in:
JimLee168 2014-07-27 19:02:01 +08:00
parent 62d1948b70
commit 9722e1eb03

View File

@ -57,6 +57,7 @@
#define PSP_MODE_AT_3_PLUS 0x00001000
#define PSP_MODE_AT_3 0x00001001
const int RIFF_CHUNK_MAGIC = 0x46464952;
const int FMT_CHUNK_MAGIC = 0x20746D66;
const int DATA_CHUNK_MAGIC = 0x61746164;
const int SMPL_CHUNK_MAGIC = 0x6C706D73;
@ -411,6 +412,11 @@ int Atrac::Analyze() {
// TODO: Validate stuff.
if (Memory::Read_U32(first.addr) != RIFF_CHUNK_MAGIC) {
ERROR_LOG(ME, "Atrac buffer invalid RIFF header: %08x", first.addr);
return ATRAC_ERROR_UNKNOWN_FORMAT;
}
// RIFF size excluding chunk header.
first.filesize = Memory::Read_U32(first.addr + 4) + 8;