From: <sv...@op...> - 2024-03-17 16:34:15
|
Author: sagamusix Date: Sun Mar 17 17:33:56 2024 New Revision: 20415 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20415 Log: 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). ........ Modified: branches/OpenMPT-1.29/ (props changed) branches/OpenMPT-1.29/soundlib/Load_okt.cpp Modified: branches/OpenMPT-1.29/soundlib/Load_okt.cpp ============================================================================== --- branches/OpenMPT-1.29/soundlib/Load_okt.cpp Sun Mar 17 17:33:42 2024 (r20414) +++ branches/OpenMPT-1.29/soundlib/Load_okt.cpp Sun Mar 17 17:33:56 2024 (r20415) @@ -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) @@ -279,19 +279,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; } @@ -305,7 +292,6 @@ return false; } - // prepare some arrays to store offsets etc. std::vector<FileReader> patternChunks; std::vector<FileReader> sampleChunks; std::vector<bool> sample7bit; // 7-/8-bit sample @@ -322,15 +308,11 @@ { 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 @@ sampleChunks.push_back(chunk); } break; - - default: - // Non-ASCII chunk ID? - if(iffHead.signature & 0x80808080) - return false; - break; } } |