Permalink
Browse files

Fix 2 buffer overflow reported by Secunia. Fixed compilation on 64bit.

  • Loading branch information...
1 parent f790037 commit 446324a45a6d165b1941a4758f6cd221301b479e realtech committed Jan 12, 2010
Showing with 16 additions and 10 deletions.
  1. +2 −5 include/mikmod_internals.h
  2. +6 −1 loaders/load_it.c
  3. +5 −1 loaders/load_ult.c
  4. +3 −3 macosx/libmikmod.xcodeproj/project.pbxproj
@@ -20,7 +20,7 @@
/*==============================================================================
- $Id: mikmod_internals.h,v 1.6 2007/12/06 17:44:29 denis111 Exp $
+ $Id: mikmod_internals.h,v 1.7 2010/01/12 03:30:31 realtech Exp $
MikMod sound library internal definitions
@@ -43,12 +43,9 @@ extern "C" {
/*========== More type definitions */
/* SLONGLONG: 64bit, signed */
-#if defined (__arch64__) || defined(__alpha)
+#if defined (__arch64__) || defined(__alpha) || defined (__x64_64) || defined (_LP64) || defined (__powerpc64__)
typedef long SLONGLONG;
#define NATIVE_64BIT_INT
-#elif defined(__powerpc64__)
-typedef long long SLONGLONG;
-#define NATIVE_64BIT_INT
#elif defined(__WATCOMC__)
typedef __int64 SLONGLONG;
#elif defined(WIN32) && !defined(__MWERKS__)
View
@@ -20,7 +20,7 @@
/*==============================================================================
- $Id: load_it.c,v 1.3 2005/04/07 19:57:38 realtech Exp $
+ $Id: load_it.c,v 1.4 2010/01/12 03:30:32 realtech Exp $
Impulse tracker (IT) module loader
@@ -862,6 +862,11 @@ BOOL IT_Load(BOOL curious)
#endif
IT_ProcessEnvelope(vol);
+
+ // Secunia SA37775
+ if (ih.volpts>= ENVPOINTS)
+ ih.volpts = ENVPOINTS-1;
+
for(u=0;u<ih.volpts;u++)
d->volenv[u].val=(ih.volnode[u]<<2);
View
@@ -20,7 +20,7 @@
/*==============================================================================
- $Id: load_ult.c,v 1.2 2005/03/30 19:10:06 realtech Exp $
+ $Id: load_ult.c,v 1.3 2010/01/12 03:30:32 realtech Exp $
Ultratracker (ULT) module loader
@@ -225,6 +225,10 @@ BOOL ULT_Load(BOOL curious)
for(t=0;t<of.numpat;t++)
of.patterns[(t*of.numchn)+u]=tracks++;
+ // SA37775
+ if (of.numchn>=UF_MAXCHAN)
+ of.numchn=UF_MAXCHAN - 1;
+
/* read pan position table for v1.5 and higher */
if(mh.id[14]>='3') {
for(t=0;t<of.numchn;t++) of.panning[t]=_mm_read_UBYTE(modreader)<<4;
@@ -124,7 +124,7 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
- A48F9EFF05EB7BAC0073A1B4 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; path = Info.plist; sourceTree = "<group>"; };
+ A48F9EFF05EB7BAC0073A1B4 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
A48F9F1505EB7C0F0073A1B4 /* drv_aiff.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = drv_aiff.c; path = ../drivers/drv_aiff.c; sourceTree = "<group>"; };
A48FA0FE05EB7CBE0073A1B4 /* InfoPlist.strings */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.strings; path = InfoPlist.strings; sourceTree = "<group>"; };
A491831405D9581C00665C37 /* drv_pipe.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = drv_pipe.c; path = ../drivers/drv_pipe.c; sourceTree = "<group>"; };
@@ -415,10 +415,12 @@
0867D690FE84028FC02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = F4979A1D08AFF5D0001ABEC2 /* Build configuration list for PBXProject "libmikmod" */;
+ compatibilityVersion = "Xcode 2.4";
hasScannedForEncodings = 1;
mainGroup = 0867D691FE84028FC02AAC07 /* libmikmod */;
productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
projectDirPath = "";
+ projectRoot = "";
targets = (
A4E3AF2605D43FCC000F1B47 /* CoreAudio Framework */,
A4E3AF5D05D43FCC000F1B47 /* CoreAudio Static Library */,
@@ -581,7 +583,6 @@
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "@executable_path/../Frameworks";
LIBRARY_SEARCH_PATHS = "";
- OPTIMIZATION_CFLAGS = "-O0";
OTHER_CFLAGS = "";
OTHER_LDFLAGS = (
"-seg1addr",
@@ -678,7 +679,6 @@
GCC_PREPROCESSOR_DEFINITIONS = HAVE_CONFIG_H;
HEADER_SEARCH_PATHS = ../include;
LIBRARY_STYLE = STATIC;
- OPTIMIZATION_CFLAGS = "-O0";
OTHER_CFLAGS = (
"-ffast-math",
"-fpeephole",

0 comments on commit 446324a

Please sign in to comment.