Skip to content

Commit

Permalink
[Fix] MED: Fix possible crash when loading synth/hybrid instrument wi…
Browse files Browse the repository at this point in the history
…th number of waveforms = 0xFFFF (special case taken from libxmp, but I don't think I have found any such file in the wild so far).

git-svn-id: https://source.openmpt.org/svn/openmpt/trunk/OpenMPT@21656 56274372-70c3-4bfc-bfc3-4c3a0b034d27
  • Loading branch information
sagamusix committed Sep 21, 2024
1 parent fc37b94 commit 0b2478c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion soundlib/Load_med.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -999,7 +999,8 @@ bool CSoundFile::ReadMED(FileReader &file, ModLoadingFlags loadFlags)
TranslateMEDSynthScript(synthInstr.volTable, synthInstr.volTableLen, synthInstr.volSpeed, instrExt.hold, instrExt.decay, instr.synth.m_scripts[0], true);
TranslateMEDSynthScript(synthInstr.waveTable, synthInstr.waveTableLen, synthInstr.waveSpeed, instrExt.hold, instrExt.decay, instr.synth.m_scripts[1], false);

file.ReadVector(waveformOffsets, synthInstr.numWaveforms);
if(synthInstr.numWaveforms <= 64)
file.ReadVector(waveformOffsets, synthInstr.numWaveforms);
} else if(isSynth)
{
instr.AssignSample(0);
Expand Down

0 comments on commit 0b2478c

Please sign in to comment.