From: <sv...@op...> - 2024-03-17 16:33:10
|
Author: sagamusix Date: Sun Mar 17 17:32:54 2024 New Revision: 20412 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20412 Log: [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). Modified: trunk/OpenMPT/soundlib/Load_okt.cpp Modified: trunk/OpenMPT/soundlib/Load_okt.cpp ============================================================================== --- trunk/OpenMPT/soundlib/Load_okt.cpp Sun Mar 17 13:46:53 2024 (r20411) +++ trunk/OpenMPT/soundlib/Load_okt.cpp Sun Mar 17 17:32:54 2024 (r20412) @@ -29,8 +29,8 @@ 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) @@ -328,19 +328,6 @@ { 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; } @@ -354,7 +341,6 @@ return false; } - // prepare some arrays to store offsets etc. std::vector<FileReader> patternChunks; std::vector<FileReader> sampleChunks; std::array<int8, 8> pairedChn{{}}; @@ -371,15 +357,11 @@ { OktIffChunk iffHead; if(!file.ReadStruct(iffHead)) - { break; - } FileReader chunk = file.ReadChunk(iffHead.chunksize); if(!chunk.IsValid()) - { - break; - } + continue; switch(iffHead.signature) { @@ -457,12 +439,6 @@ sampleChunks.push_back(chunk); } break; - - default: - // Non-ASCII chunk ID? - if(iffHead.signature & 0x80808080) - return false; - break; } } |