Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/load_xm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,11 @@ BOOL CSoundFile::ReadXM(const BYTE *lpStream, DWORD dwMemLength)
if (dwMemPos >= dwMemLength) break;
}
}
// SECURITY: sample sizes are attacker-controlled; the loop above can
// leave dwMemPos past the end of the buffer (or wrapped). Every tail
// parser below (TEXT, MIDI, mix plugins) trusts dwMemPos, so clamp once
// here rather than guarding each site against integer overflow.
if (dwMemPos > dwMemLength) dwMemPos = dwMemLength;
// Read song comments: "TEXT"
if ((dwMemPos + 8 < dwMemLength) && (bswapLE32(*((DWORD *)(lpStream+dwMemPos))) == 0x74786574))
{
Expand Down