summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'media-libs/libmodplug/files/libmodplug-0.8-CVE-2006-4192.patch')
-rw-r--r--media-libs/libmodplug/files/libmodplug-0.8-CVE-2006-4192.patch36
1 files changed, 36 insertions, 0 deletions
diff --git a/media-libs/libmodplug/files/libmodplug-0.8-CVE-2006-4192.patch b/media-libs/libmodplug/files/libmodplug-0.8-CVE-2006-4192.patch
new file mode 100644
index 000000000000..c80af44b37c3
--- /dev/null
+++ b/media-libs/libmodplug/files/libmodplug-0.8-CVE-2006-4192.patch
@@ -0,0 +1,36 @@
+--- libmodplug/src/sndfile.cpp 2006/08/10 02:26:44 1.3
++++ libmodplug/src/sndfile.cpp 2006/11/02 04:19:00 1.4
+@@ -5,7 +5,7 @@
+ * Adam Goode <adam@evdebs.org> (endian and char fixes for PPC)
+ */
+
+-#include <math.h> //for GCCFIX
++#include <math.h> //for GCCFIX
+ #include <libmodplug/stdafx.h>
+ #include <libmodplug/sndfile.h>
+
+@@ -228,7 +228,8 @@
+ if (pins->nGlobalVol > 64) pins->nGlobalVol = 64;
+ }
+ // Check invalid instruments
+- while ((m_nInstruments > 0) && (!Headers[m_nInstruments])) m_nInstruments--;
++ while ((m_nInstruments > 0) && (!Headers[m_nInstruments]))
++ m_nInstruments--;
+ // Set default values
+ if (m_nSongPreAmp < 0x20) m_nSongPreAmp = 0x20;
+ if (m_nDefaultTempo < 32) m_nDefaultTempo = 125;
+@@ -1081,11 +1082,12 @@
+
+
+ UINT CSoundFile::ReadSample(MODINSTRUMENT *pIns, UINT nFlags, LPCSTR lpMemFile, DWORD dwMemLength)
+-//------------------------------------------------------------------------------------------------
++//------------------------------------------------------------------------------
+ {
+ UINT len = 0, mem = pIns->nLength+6;
+
+- if ((!pIns) || (pIns->nLength < 4) || (!lpMemFile)) return 0;
++ // Disable >2Gb samples,(preventing buffer overflow in AllocateSample)
++ if ((!pIns) || ((int)pIns->nLength < 4) || (!lpMemFile)) return 0;
+ if (pIns->nLength > MAX_SAMPLE_LENGTH) pIns->nLength = MAX_SAMPLE_LENGTH;
+ pIns->uFlags &= ~(CHN_16BIT|CHN_STEREO);
+ if (nFlags & RSF_16BIT)