Skip to content

Commit

Permalink
Merged revision(s) 20641 from trunk/OpenMPT:
Browse files Browse the repository at this point in the history
[Mod] MO3: Further reduce maximum allowed music data (not samples) size from 2GB to 512MB.
........


git-svn-id: https://source.openmpt.org/svn/openmpt/branches/OpenMPT-1.30@20643 56274372-70c3-4bfc-bfc3-4c3a0b034d27
  • Loading branch information
sagamusix committed Apr 21, 2024
1 parent 7a09bb6 commit 11975ee
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion soundlib/Load_mo3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,9 @@ static bool ValidateHeader(const MO3ContainerHeader &containerHeader)
{
return false;
}
if(containerHeader.musicSize <= sizeof(MO3FileHeader) || containerHeader.musicSize >= uint32_max / 2u)
// Due to the LZ algorithm's unbounded back window, we could reach gigantic sizes with just a few dozen bytes.
// 512 MB of music data (not samples) is chosen as a safeguard that is probably (hopefully) *way* beyond anything a real-world module will ever reach.
if(containerHeader.musicSize <= sizeof(MO3FileHeader) || containerHeader.musicSize >= 0x2000'0000)
{
return false;
}
Expand Down

0 comments on commit 11975ee

Please sign in to comment.