From e49f726ff2a902acfb68ece4b8465a61cf240d81 Mon Sep 17 00:00:00 2001 From: Johannes Schultz Date: Sun, 17 Mar 2024 16:33:56 +0000 Subject: [PATCH] Merged revision(s) 20412 from trunk/OpenMPT: [Fix] OKT: Don't reject files with non-ASCII chunk IDs. This fixes "katharsis - piano lesson.okta" which appears to have some leftover junk with unused sample data at the end of the file (https://www.un4seen.com/forum/?topic=15448.msg142562#msg142562). ........ git-svn-id: https://source.openmpt.org/svn/openmpt/branches/OpenMPT-1.29@20415 56274372-70c3-4bfc-bfc3-4c3a0b034d27 --- soundlib/Load_okt.cpp | 30 +++--------------------------- 1 file changed, 3 insertions(+), 27 deletions(-) diff --git a/soundlib/Load_okt.cpp b/soundlib/Load_okt.cpp index 344ac8dd90f..abd6261e022 100644 --- a/soundlib/Load_okt.cpp +++ b/soundlib/Load_okt.cpp @@ -29,8 +29,8 @@ struct OktIffChunk idSBOD = MagicBE("SBOD"), }; - uint32be signature; // IFF chunk name - uint32be chunksize; // chunk size without header + uint32be signature; // IFF chunk name + uint32be chunksize; // chunk size without header }; MPT_BINARY_STRUCT(OktIffChunk, 8) @@ -279,19 +279,6 @@ CSoundFile::ProbeResult CSoundFile::ProbeFileHeaderOKT(MemoryFileReader file, co { return ProbeFailure; } - OktIffChunk iffHead; - if(!file.ReadStruct(iffHead)) - { - return ProbeWantMoreData; - } - if(iffHead.chunksize == 0) - { - return ProbeFailure; - } - if((iffHead.signature & 0x80808080u) != 0) // ASCII? - { - return ProbeFailure; - } MPT_UNREFERENCED_PARAMETER(pfilesize); return ProbeSuccess; } @@ -305,7 +292,6 @@ bool CSoundFile::ReadOKT(FileReader &file, ModLoadingFlags loadFlags) return false; } - // prepare some arrays to store offsets etc. std::vector patternChunks; std::vector sampleChunks; std::vector sample7bit; // 7-/8-bit sample @@ -322,15 +308,11 @@ bool CSoundFile::ReadOKT(FileReader &file, ModLoadingFlags loadFlags) { OktIffChunk iffHead; if(!file.ReadStruct(iffHead)) - { break; - } FileReader chunk = file.ReadChunk(iffHead.chunksize); if(!chunk.IsValid()) - { - break; - } + continue; switch(iffHead.signature) { @@ -408,12 +390,6 @@ bool CSoundFile::ReadOKT(FileReader &file, ModLoadingFlags loadFlags) sampleChunks.push_back(chunk); } break; - - default: - // Non-ASCII chunk ID? - if(iffHead.signature & 0x80808080) - return false; - break; } }