4050b0b53e
Various integer overflows and off-by-one errors in libmodplug.
17 lines
700 B
Plaintext
17 lines
700 B
Plaintext
$OpenBSD: patch-src_load_dsm_cpp,v 1.1 2011/08/18 17:56:47 jasper Exp $
|
|
|
|
Fix AMS and DSM too large by one - SA45131/C
|
|
From upstream git: 26243ab9fe1171f70053e9aec4b20e9f7de9e4ef
|
|
|
|
--- src/load_dsm.cpp.orig Thu Aug 18 19:49:21 2011
|
|
+++ src/load_dsm.cpp Thu Aug 18 19:49:47 2011
|
|
@@ -101,7 +101,7 @@ BOOL CSoundFile::ReadDSM(LPCBYTE lpStream, DWORD dwMem
|
|
if (m_nChannels < 4) m_nChannels = 4;
|
|
if (m_nChannels > 16) m_nChannels = 16;
|
|
m_nSamples = psong->numsmp;
|
|
- if (m_nSamples > MAX_SAMPLES) m_nSamples = MAX_SAMPLES;
|
|
+ if (m_nSamples >= MAX_SAMPLES) m_nSamples = MAX_SAMPLES - 1;
|
|
m_nDefaultSpeed = psong->speed;
|
|
m_nDefaultTempo = psong->bpm;
|
|
m_nDefaultGlobalVolume = psong->globalvol << 2;
|