Skip to content

Commit

Permalink
Merged revision(s) 20901 from trunk/OpenMPT:
Browse files Browse the repository at this point in the history
[Fix] PSM: File header probing was stricter than actual file loader.
........
Merged revision(s) 20903-20904 from trunk/OpenMPT:
[Fix] Fuzzer: Don't return from the AFL loop if we weren't able to load a file.
........
[Fix] PSM: Header probing was still too strict.
........



git-svn-id: https://source.openmpt.org/svn/openmpt/branches/OpenMPT-1.28@20908 56274372-70c3-4bfc-bfc3-4c3a0b034d27
  • Loading branch information
sagamusix committed Jun 2, 2024
1 parent f3c308d commit 570c1f4
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 14 deletions.
2 changes: 1 addition & 1 deletion contrib/fuzzing/fuzz.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ int main( int argc, char * argv[] ) {
OpenMPT::mpt::reinit_global_random();
openmpt_module * mod = openmpt_module_create_from_memory2( fileBuffer, fileSize, nullptr, nullptr, ErrFunc, nullptr, nullptr, nullptr, nullptr);
if ( mod == NULL )
return 1;
break;

// verify API contract: If the file can be loaded, header probing must be successful too.
if ( openmpt_probe_file_header( OPENMPT_PROBE_FILE_HEADER_FLAGS_DEFAULT, fileBuffer, fileSize, fileSize, nullptr, nullptr, ErrFunc, nullptr, nullptr, nullptr ) == OPENMPT_PROBE_FILE_HEADER_RESULT_FAILURE )
Expand Down
13 changes: 0 additions & 13 deletions soundlib/Load_psm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,19 +236,6 @@ CSoundFile::ProbeResult CSoundFile::ProbeFileHeaderPSM(MemoryFileReader file, co
{
return ProbeFailure;
}
PSMChunk chunkHeader;
if(!file.ReadStruct(chunkHeader))
{
return ProbeWantMoreData;
}
if(chunkHeader.length == 0)
{
return ProbeFailure;
}
if((chunkHeader.id & 0x7f7f7f7fu) != chunkHeader.id) // ASCII?
{
return ProbeFailure;
}
MPT_UNREFERENCED_PARAMETER(pfilesize);
return ProbeSuccess;
}
Expand Down

0 comments on commit 570c1f4

Please sign in to comment.