Account for uneven sized chunks by rounding up.

Chunks have an extra pad byte if the size is uneven.  This probably isn't
happening, but just to be safe.
This commit is contained in:
Unknown W. Brackets 2015-10-18 12:50:40 -07:00
parent e632b32be2
commit d0a9813844

View File

@ -573,6 +573,11 @@ int Atrac::Analyze() {
while (first.filesize >= offset + 8 && !bfoundData) {
int chunkMagic = Memory::Read_U32(first.addr + offset);
u32 chunkSize = Memory::Read_U32(first.addr + offset + 4);
// Account for odd sized chunks.
if (chunkSize & 1) {
WARN_LOG_REPORT_ONCE(oddchunk, ME, "RIFF chunk had uneven size");
}
chunkSize += (chunkSize & 1);
offset += 8;
if (chunkSize > first.filesize - offset)
break;