Skip to content

Commit

Permalink
[Fix] Possible out-of-bounds read with malformed IT / MPTM / XM files…
Browse files Browse the repository at this point in the history
… using the SymMOD Echo plugin when modern tempo mode with an invalid rows per beat setting of 0 was used. This fix is a backport of the following:

Merged revision(s) 16484 from trunk/OpenMPT:
[Fix] Reject a rows per beat value of 0 when loading a file with modern tempo mode, as this would result in infinite tick length and thus undefined behaviour when trying to convert the tick length to int (found with afl++ + ubsan)
........


git-svn-id: https://source.openmpt.org/svn/openmpt/branches/OpenMPT-1.30@21607 56274372-70c3-4bfc-bfc3-4c3a0b034d27
  • Loading branch information
sagamusix committed Sep 18, 2024
1 parent ee4aa59 commit e2604a9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions soundlib/Sndfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,8 @@ bool CSoundFile::CreateInternal(FileReader file, ModLoadingFlags loadFlags)
if(!m_nDefaultSpeed)
m_nDefaultSpeed = 6;

if(!m_nDefaultRowsPerBeat && m_nTempoMode == TempoMode::Modern)
m_nDefaultRowsPerBeat = 1;
if(m_nDefaultRowsPerMeasure < m_nDefaultRowsPerBeat)
m_nDefaultRowsPerMeasure = m_nDefaultRowsPerBeat;
LimitMax(m_nDefaultRowsPerBeat, MAX_ROWS_PER_BEAT);
Expand Down

0 comments on commit e2604a9

Please sign in to comment.