Skip to content

Commit

Permalink
Merged revision(s) 20960 from trunk/OpenMPT:
Browse files Browse the repository at this point in the history
[Fix] MO3: Don't try to load comrpessed samples if the header says that it's a 0-length sample anyway. This may cause a sample buffer to be allocated and its size be reduced to 0, which is an API violation (see assertion in ModSample::HasSampleData()). Found with afl++.
........


git-svn-id: https://source.openmpt.org/svn/openmpt/branches/OpenMPT-1.30@20962 56274372-70c3-4bfc-bfc3-4c3a0b034d27
  • Loading branch information
sagamusix committed Jun 8, 2024
1 parent 026ae49 commit a65d106
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions soundlib/Load_mo3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1360,6 +1360,8 @@ bool CSoundFile::ReadMO3(FileReader &file, ModLoadingFlags loadFlags)
sample.uFlags.set(CHN_STEREO);

FileReader sampleData = file.ReadChunk(smpHeader.compressedSize);
if(!smpHeader.length)
continue;
const uint8 numChannels = sample.GetNumChannels();

if(compression == MO3Sample::smpDeltaCompression || compression == MO3Sample::smpDeltaPrediction)
Expand Down

0 comments on commit a65d106

Please sign in to comment.