Hello community,

here is the log from the commit of package libmodplug for openSUSE:Factory
checked in at Thu May 26 10:59:04 CEST 2011.



--------
--- libmodplug/libmodplug.changes       2011-05-22 23:41:31.000000000 +0200
+++ /mounts/work_src_done/STABLE/libmodplug/libmodplug.changes  2011-05-25 
16:29:02.000000000 +0200
@@ -1,0 +2,6 @@
+Wed May 25 16:27:11 CEST 2011 - sbra...@suse.cz
+
+- Updated to version 0.8.8.3:
+  * Several security fixes (including CVE-2011-1761, bnc#691137).
+
+-------------------------------------------------------------------

calling whatdependson for head-i586


Old:
----
  _service:recompress:download_url:libmodplug-0.8.8.2.tar.bz2

New:
----
  _service:recompress:download_url:libmodplug-0.8.8.3.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ _service:set_version:libmodplug.spec ++++++
--- /var/tmp/diff_new_pack.IuaC4G/_old  2011-05-26 10:52:15.000000000 +0200
+++ /var/tmp/diff_new_pack.IuaC4G/_new  2011-05-26 10:52:15.000000000 +0200
@@ -20,7 +20,7 @@
 
 Name:           libmodplug
 Summary:        A MOD playing library
-Version: 0.8.8.2
+Version: 0.8.8.3
 Release: 0
 Group:          System/Libraries
 License:        Public Domain
@@ -29,7 +29,7 @@
 Source1:        baselibs.conf
 # PATCH-FIX-OPENSUSE libmodplug-timidity.patch -- set paths to openSUSE 
timidity package
 Patch1:         libmodplug-timidity.patch
-BuildRequires:  gcc-c++ pkg-config dos2unix
+BuildRequires:  dos2unix gcc-c++ pkg-config
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 
 %description

++++++ libmodplug.spec ++++++
--- /var/tmp/diff_new_pack.IuaC4G/_old  2011-05-26 10:52:15.000000000 +0200
+++ /var/tmp/diff_new_pack.IuaC4G/_new  2011-05-26 10:52:15.000000000 +0200
@@ -21,7 +21,7 @@
 Name:           libmodplug
 Summary:        A MOD playing library
 Version:        to_be_filled_by_service
-Release:        3
+Release:        4
 Group:          System/Libraries
 License:        Public Domain
 Url:            http://modplug-xmms.sourceforge.net

++++++ _service ++++++
--- /var/tmp/diff_new_pack.IuaC4G/_old  2011-05-26 10:52:15.000000000 +0200
+++ /var/tmp/diff_new_pack.IuaC4G/_new  2011-05-26 10:52:15.000000000 +0200
@@ -3,12 +3,12 @@
   <service name="download_url">
     <param name="protocol">http</param>
     <param name="host">downloads.sourceforge.net</param>
-    <param 
name="path">/project/modplug-xmms/libmodplug/0.8.8.2/libmodplug-0.8.8.2.tar.gz</param>
+    <param 
name="path">/project/modplug-xmms/libmodplug/0.8.8.3/libmodplug-0.8.8.3.tar.gz</param>
   </service>
   <service name="verify_file">
-    <param name="file">_service:download_url:libmodplug-0.8.8.2.tar.gz</param>
+    <param name="file">_service:download_url:libmodplug-0.8.8.3.tar.gz</param>
     <param name="verifier">sha256</param>
-    <param 
name="checksum">6dedf79713f7ab75258c097a8749dab9127c81692858dab5295eef504ea61705</param>
+    <param 
name="checksum">0d52a259e85c4f50491d66128d7c476bc67a44d3930b965014954289c0c3f4a5</param>
   </service>
   <service name="recompress">
     <param name="file">*.gz</param>

++++++ _service:recompress:download_url:libmodplug-0.8.8.2.tar.bz2 -> 
_service:recompress:download_url:libmodplug-0.8.8.3.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libmodplug-0.8.8.2/Makefile.in 
new/libmodplug-0.8.8.3/Makefile.in
--- old/libmodplug-0.8.8.2/Makefile.in  2011-04-02 01:29:16.000000000 +0200
+++ new/libmodplug-0.8.8.3/Makefile.in  2011-05-08 15:43:49.000000000 +0200
@@ -173,6 +173,7 @@
 LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
+LT_LDFLAGS = @LT_LDFLAGS@
 MAKEINFO = @MAKEINFO@
 MKDIR_P = @MKDIR_P@
 MODPLUG_LIBRARY_VERSION = @MODPLUG_LIBRARY_VERSION@
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libmodplug-0.8.8.2/configure 
new/libmodplug-0.8.8.3/configure
--- old/libmodplug-0.8.8.2/configure    2011-04-02 01:29:07.000000000 +0200
+++ new/libmodplug-0.8.8.3/configure    2011-05-08 15:43:49.000000000 +0200
@@ -606,8 +606,7 @@
 LTLIBOBJS
 LIBOBJS
 MODPLUG_LIBRARY_VERSION
-MINGW32_FALSE
-MINGW32_TRUE
+LT_LDFLAGS
 OTOOL64
 OTOOL
 LIPO
@@ -2948,7 +2947,7 @@
 
 # Define the identity of the package.
  PACKAGE=libmodplug
- VERSION=0.8.8.2
+ VERSION=0.8.8.3
 
 
 cat >>confdefs.h <<_ACEOF
@@ -3000,18 +2999,6 @@
 esac
 AM_BACKSLASH='\'
 
-# Check whether --enable-silent-rules was given.
-if test "${enable_silent_rules+set}" = set; then :
-  enableval=$enable_silent_rules;
-fi
-
-case $enable_silent_rules in
-yes) AM_DEFAULT_VERBOSITY=0;;
-no)  AM_DEFAULT_VERBOSITY=1;;
-*)   AM_DEFAULT_VERBOSITY=0;;
-esac
-AM_BACKSLASH='\'
-
 ac_config_headers="$ac_config_headers src/config.h"
 
 
@@ -14687,17 +14674,13 @@
 
 
 case "$host" in
-       *mingw32* )
-               MINGW32=yes
+       *mingw* | *cygwin*)
+               LT_LDFLAGS="-no-undefined"
+               ;;
+       *)
+               LT_LDFLAGS=""
                ;;
 esac
- if test "x$MINGW32" = "xyes"; then
-  MINGW32_TRUE=
-  MINGW32_FALSE='#'
-else
-  MINGW32_TRUE='#'
-  MINGW32_FALSE=
-fi
 
 
 case ${target_os} in
@@ -14933,10 +14916,6 @@
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 
-if test -z "${MINGW32_TRUE}" && test -z "${MINGW32_FALSE}"; then
-  as_fn_error $? "conditional \"MINGW32\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
 
 : ${CONFIG_STATUS=./config.status}
 ac_write_fail=0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libmodplug-0.8.8.2/configure.in 
new/libmodplug-0.8.8.3/configure.in
--- old/libmodplug-0.8.8.2/configure.in 2011-04-02 01:28:46.000000000 +0200
+++ new/libmodplug-0.8.8.3/configure.in 2011-05-08 15:42:58.000000000 +0200
@@ -3,9 +3,8 @@
 AC_PREREQ(2.63)
 AC_CONFIG_SRCDIR([Makefile.am])
 
-AM_INIT_AUTOMAKE(libmodplug, 0.8.8.2)
+AM_INIT_AUTOMAKE(libmodplug, 0.8.8.3)
 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES])
-AM_SILENT_RULES([yes])
 AC_CONFIG_HEADERS([src/config.h])
 
 dnl Checks for programs.
@@ -33,11 +32,14 @@
 
 AC_CANONICAL_HOST
 case "$host" in
-       *mingw32* )
-               MINGW32=yes
+       *mingw* | *cygwin*)
+               LT_LDFLAGS="-no-undefined"
+               ;;
+       *)
+               LT_LDFLAGS=""
                ;;
 esac
-AM_CONDITIONAL([MINGW32], [test "x$MINGW32" = "xyes"])
+AC_SUBST(LT_LDFLAGS)
 
 case ${target_os} in
        *sun* | *solaris*)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libmodplug-0.8.8.2/src/Makefile.am 
new/libmodplug-0.8.8.3/src/Makefile.am
--- old/libmodplug-0.8.8.2/src/Makefile.am      2011-03-25 23:02:07.000000000 
+0100
+++ new/libmodplug-0.8.8.3/src/Makefile.am      2011-04-16 01:24:18.000000000 
+0200
@@ -1,10 +1,7 @@
 AM_CPPFLAGS = -I$(top_srcdir)/src/libmodplug
 
-if MINGW32
-  AM_LDFLAGS = -no-undefined
-endif
 lib_LTLIBRARIES = libmodplug.la
-libmodplug_la_LDFLAGS = -version-info $(MODPLUG_LIBRARY_VERSION)
+libmodplug_la_LDFLAGS = -version-info $(MODPLUG_LIBRARY_VERSION) $(LT_LDFLAGS)
 libmodplug_la_LIBADD = -lm
 libmodplug_la_SOURCES = tables.h         \
                         sndmix.cpp         \
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libmodplug-0.8.8.2/src/Makefile.in 
new/libmodplug-0.8.8.3/src/Makefile.in
--- old/libmodplug-0.8.8.2/src/Makefile.in      2011-04-02 01:29:16.000000000 
+0200
+++ new/libmodplug-0.8.8.3/src/Makefile.in      2011-05-08 15:43:49.000000000 
+0200
@@ -176,6 +176,7 @@
 LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
+LT_LDFLAGS = @LT_LDFLAGS@
 MAKEINFO = @MAKEINFO@
 MKDIR_P = @MKDIR_P@
 MODPLUG_LIBRARY_VERSION = @MODPLUG_LIBRARY_VERSION@
@@ -252,9 +253,8 @@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 AM_CPPFLAGS = -I$(top_srcdir)/src/libmodplug
-@MINGW32_TRUE@AM_LDFLAGS = -no-undefined
 lib_LTLIBRARIES = libmodplug.la
-libmodplug_la_LDFLAGS = -version-info $(MODPLUG_LIBRARY_VERSION)
+libmodplug_la_LDFLAGS = -version-info $(MODPLUG_LIBRARY_VERSION) $(LT_LDFLAGS)
 libmodplug_la_LIBADD = -lm
 libmodplug_la_SOURCES = tables.h         \
                         sndmix.cpp         \
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libmodplug-0.8.8.2/src/load_abc.cpp 
new/libmodplug-0.8.8.3/src/load_abc.cpp
--- old/libmodplug-0.8.8.2/src/load_abc.cpp     2011-03-25 23:02:07.000000000 
+0100
+++ new/libmodplug-0.8.8.3/src/load_abc.cpp     2011-05-08 17:10:02.000000000 
+0200
@@ -277,11 +277,45 @@
 }
 #endif
 
-
 static int abc_isvalidchar(char c) {
        return(isalpha(c) || isdigit(c) || isspace(c) || c == '%' || c == ':');
 }
 
+static const char *abc_skipspace(const char *p)
+{
+       while (*p && isspace(*p))
+               p++;
+       return p;
+}
+
+static void abc_extractkeyvalue(char *key, size_t key_max,
+                                                               char *value, 
size_t value_max, const char *src)
+{
+       while (*src && isspace(*src))
+               src++;
+
+       size_t key_size;
+       for (key_size = 0; key_size < key_max - 1 && *src;) {
+               if (*src == '=') {
+                       src++;
+                       break;
+               }
+               key[key_size++] = *src++;
+       }
+       while (key_size > 0 && isspace(key[key_size - 1]))
+               key_size--;
+       key[key_size] = '\0';
+
+       while (*src && isspace(*src))
+               src++;
+
+       size_t value_size;
+       for (value_size = 0; value_size < value_max - 1 && *src;)
+               value[value_size++] = *src++;
+       while (value_size > 0 && isspace(value[value_size - 1]))
+               value_size--;
+       value[value_size] = '\0';
+}
 
 static void abc_message(const char *s1, const char *s2)
 {
@@ -308,6 +342,7 @@
 static uint32_t notelen_notediv_to_ticks(int speed, int len, int div)
 {
        uint32_t u;
+       if (div == 0) return 0;
        u = (ROWSPERNOTE * RESOLUTION * speed * len * global_tempo_factor) / 
(div * global_tempo_divider);
        return u;
 }
@@ -454,7 +489,7 @@
        if( mmfeof(mmfile) ) return EOF;
        b = mmfile->mm[mmfile->pos];
        mmfile->pos++;
-       if( b=='\r' && mmfile->mm[mmfile->pos] == '\n' ) {
+       if( b=='\r' && !mmfeof(mmfile) && mmfile->mm[mmfile->pos] == '\n' ) {
                b = '\n';
                mmfile->pos++;
        }
@@ -531,21 +566,13 @@
 // 
=============================================================================
 {
     ABCMACRO *retval;
-               const char *p;
-               char buf[256],*q;
-               for( p=m; *p && isspace(*p); p++ ) ;
-               for( q=buf; *p && *p != '='; p++ )
-                       *q++ = *p;
-               if( q != buf )
-                       while( isspace(q[-1]) ) q--;
-               *q = '\0';
+       char key[256], value[256];
+       abc_extractkeyvalue(key, sizeof(key), value, sizeof(value), m);
+
     retval = (ABCMACRO *)_mm_calloc(h->macrohandle, 1,sizeof(ABCTRACK));
-    retval->name  = DupStr(h->macrohandle, buf,strlen(buf));
+    retval->name  = DupStr(h->macrohandle, key, strlen(key));
                retval->n     = strrchr(retval->name, 'n'); // for transposing 
macro's
-               for( p++; *p && isspace(*p); p++ ) ;
-               strncpy(buf,p,200);
-               for( q=&buf[strlen(buf)-1]; q!=buf && isspace(*q); q-- ) *q = 
'\0';
-    retval->subst = DupStr(h->macrohandle, buf, strlen(buf));
+    retval->subst = DupStr(h->macrohandle, value, strlen(value));
                retval->next  = h->macro;
                h->macro      = retval;
 }
@@ -555,24 +582,15 @@
 // 
=============================================================================
 {
     ABCMACRO *retval, *mp;
-               const char *p;
-               char buf[256], let[2], *q;
-               for( p=m; *p && isspace(*p); p++ ) ;
-               for( q=buf; *p && *p != '='; p++ )
-                       *q++ = *p;
-               if( q != buf )
-                       while( isspace(q[-1]) ) q--;
-               *q = '\0';
-               if( strlen(buf) > 1 || 
strchr("~HIJKLMNOPQRSTUVWXY",toupper(buf[0])) == 0 || strchr("xy",buf[0]) ) 
return;
-               strcpy(let,buf);
-               for( p++; *p && isspace(*p); p++ ) ;
-               strncpy(buf,p,200);
-               for( q=&buf[strlen(buf)-1]; q!=buf && isspace(*q); q-- ) *q = 
'\0';
-               for( q=buf; *q; q++ )   if( *q == '!' ) *q = '+';       // 
translate oldstyle to newstyle
-               if( !strcmp(buf,"+nil+") ) { // delete a macro
+               char key[256], value[256];
+               abc_extractkeyvalue(key, sizeof(key), value, sizeof(value), m);
+               if( strlen(key) > 1 || 
strchr("~HIJKLMNOPQRSTUVWXY",toupper(key[0])) == 0 ) return;
+               while( char *q = strchr(key, '!') )
+                       *q = '+'; // translate oldstyle to newstyle
+               if( !strcmp(key,"+nil+") ) { // delete a macro
                        mp = NULL;
                        for( retval=h->umacro; retval; retval = retval->next ) {
-                               if( retval->name[0] == let[0] ) {       // 
delete this one
+                               if( retval->name[0] == key[0] ) {       // 
delete this one
                                        if( mp ) mp->next = retval->next;
                                        else h->umacro = retval->next;
                                        _mm_free(h->macrohandle, retval);
@@ -583,8 +601,8 @@
                        return;
                }
     retval = (ABCMACRO *)_mm_calloc(h->macrohandle, 1,sizeof(ABCTRACK));
-    retval->name  = DupStr(h->macrohandle, let,1);
-    retval->subst = DupStr(h->macrohandle, buf, strlen(buf));
+    retval->name  = DupStr(h->macrohandle, key, 1);
+    retval->subst = DupStr(h->macrohandle, value, strlen(value));
                retval->n     = 0;
                retval->next  = h->umacro; // by placing it up front we mask 
out the old macro until we +nil+ it
                h->umacro      = retval;
@@ -829,7 +847,7 @@
        char vc[21];
        int i, trans=0, voiceno=0, instrno = 1, channo = 0;
        for( ; *voice == ' '; voice++ ) ;       // skip leading spaces
-       for( i=0; *voice && *voice != ']' && *voice != '%' && !isspace(*voice); 
voice++ )       // can work with inline voice instructions
+       for( i=0; i+1 < sizeof(vc) && *voice && *voice != ']' && *voice != '%' 
&& !isspace(*voice); voice++ )   // can work with inline voice instructions
                vc[i++] = *voice;
        vc[i] = '\0';
        prev = NULL;
@@ -992,11 +1010,15 @@
                                        case cmdsync:
                                                if( el ) {
                                                        el->next = ep->next;
+                                                       if( !el->next )
+                                                               tp->tail = el;
                                                        
_mm_free(h->trackhandle,ep);
                                                        ep = el->next;
                                                }
                                                else {
                                                        tp->head = ep->next;
+                                                       if( !tp->head )
+                                                               tp->tail = NULL;
                                                        
_mm_free(h->trackhandle,ep);
                                                        ep = tp->head;
                                                }
@@ -1022,10 +1044,12 @@
                                _mm_free(h->trackhandle,tp);
                                tp = ptp;
                        }
-                       else {
+                       else if (tp->next) {
                                h->track = tp->next;
                                _mm_free(h->trackhandle,tp);
                                tp = h->track;
+                       } else {
+                               break;
                        }
                }
                ptp = tp;       // remember previous track
@@ -1492,7 +1516,7 @@
                        break;
        }
        d[chordbase] = d[chordnote];
-       for( i=0; p[i] && p[i] != '"' && p[i] != '/' && p[i] != '(' && p[i] != 
')' && p[i] != ' '; i++ ) s[i] = p[i];
+       for( i=0; i < sizeof(s) - 1 && p[i] && p[i] != '"' && p[i] != '/' && 
p[i] != '(' && p[i] != ')' && p[i] != ' '; i++ ) s[i] = p[i];
        s[i] = '\0';
        p = &p[i];
        if( *p=='/' ) {
@@ -1625,7 +1649,7 @@
        while( isspace(p[i]) )
                i++;
        while( p[i] == '+' ) {
-               i += abc_getexpr(p+i+1, &term);
+               i += 1 + abc_getexpr(p+i+1, &term);
                total += term;
                while( isspace(p[i]) )
                        i++;
@@ -1750,6 +1774,8 @@
        }
        if( !nd ) tempo = 120;
        else tempo = ns * nl * 4 / nd; // mod tempo is really BPM where one B 
is equal to a quartnote
+       if( tempo <= 0 )
+               tempo = 120;
        if( invoice ) {
                nl = global_tempo_factor;
                nd = global_tempo_divider;
@@ -1814,6 +1840,8 @@
                }
                if( isdigit(p[i]) ) {
                        n=abc_getnumber(p+i,&k);
+                       if( k == 0 )
+                               k = 1;
                        if( p[i-1] == ')' )
                                j *= k; // never mind multiple parens, just 
take the worst case
                        else
@@ -1833,8 +1861,10 @@
                                        for( k = n; k<j; k++ ) q[k-1] = q[k];   
// shift to the left...
                                        j--;
                                }
-                               else
+                               else {
                                        abc_message("Warning: Unbalanced right 
parens in P: definition %s",p);
+                                       break;
+                               }
                                n = j - n + 1;  // number of repeatable 
characters
                                i += abc_getnumber(p+i+1,&k);
                                while( k-- > 1 ) {
@@ -2099,7 +2129,7 @@
                                                else
                                                        x++;
                                        }
-                                       if( fading && partno < 26 && i < 255 ) 
{        // add single part with fading tracks
+                                       if( fading && partno < 25 && i < 254 ) 
{        // add single part with fading tracks
                                                partno++;
                                                ptt[partno] = e->tracktick;
                                                buf[i] = '\0'; // close up 
pfade with zero byte
@@ -2178,7 +2208,7 @@
                        break;
                }
        }
-       if( buf[i] == '\n' ) i++;
+       if( i != bufsz-2 && buf[i] == '\n' ) i++;
        buf[i] = '\0';
        return buf;
 }
@@ -2189,6 +2219,8 @@
        int i;
        int l = strlen(target);
        int n = strlen(s);
+    if (l <= 0 ||n <= 0 || strstr(s, target))
+        return;
        while( (p=strstr(h->line, target)) ) {
                if( (i=strlen(h->line)) + n - l >= (int)h->len ) {
                        h->line = (char *)_mm_recalloc(h->allochandle, h->line, 
h->len<<1, sizeof(char));
@@ -2209,15 +2241,15 @@
 static void abc_preprocess(ABCHANDLE *h, ABCMACRO *m)
 {
        int i, j, k, l, a, b;
-       char t[32];
-       char s[200],*p;
        if( m->n ) {
                k = m->n - m->name;
                for( i=0; i<14; i++ ) {
-                       strncpy(t, m->name, 32);
+                       char t[strlen(m->name) + 1];
+                       strcpy(t, m->name);
                        t[k] = "CDEFGABcdefgab"[i];
                        l = strlen(m->subst);
-                       p = s;
+                       char s[2 * l + 1];
+                       char *p = s;
                        for( j=0; j<l; j++ ) {
                                a = m->subst[j];
                                if( a > 'g' && islower(a) ) {
@@ -2226,7 +2258,7 @@
                                        *p++ = a;
                                        if( i+b < 0 )
                                                *p++ = ',';
-                                       if( i+b > 13 )
+                                       else if( i+b > 13 )
                                                *p++ = '\'';
                                }
                                else *p++ = a;
@@ -2303,22 +2335,26 @@
     char id[128];
     // scan file for first K: line (last in header)
 #ifdef NEWMIKMOD
-    _mm_fseek(mmfile,0,SEEK_SET);
+               _mm_fseek(mmfile,0,SEEK_SET);
                while(abc_fgets(mmfile,id,128)) {
 #else
                MMFILE mmfile;
                mmfile.mm = (char *)lpStream;
                mmfile.sz = dwMemLength;
-    mmfseek(&mmfile,0,SEEK_SET);
+               mmfseek(&mmfile,0,SEEK_SET);
+               int ppos = mmfile.pos;
+
                while(abc_fgets(&mmfile,id,128)) {
 #endif
+
+               if (id[0] == 0 && mmfile.pos < ppos + 120) return(0); 
//probably binary
                if (id[0] == 0) continue; // blank line.
 
                if (!abc_isvalidchar(id[0])  || !abc_isvalidchar(id[1])) {
                        return(0); // probably not an ABC.
                }
-           if(id[0]=='K' 
-                       && id[1]==':' 
+           if(id[0]=='K'
+                       && id[1]==':'
                        && (isalpha(id[2]) || isspace(id[2])) ) return 1;
                }
     return 0;
@@ -2332,7 +2368,7 @@
                char buf[10];
 #ifdef NEWMIKMOD
     MM_ALLOC     *allochandle;
-    
+
                allochandle = _mmalloc_create("Load_ABC", NULL);
     retval = (ABCHANDLE *)_mm_calloc(allochandle, 1,sizeof(ABCHANDLE));
                if( !retval ) return NULL;
@@ -2480,7 +2516,7 @@
 
 static int abc_is_global_event(ABCEVENT *e)
 {
-       return e->flg == 1 && (e->cmd == cmdtempo || e->cmd == cmdpartbrk); 
+       return e->flg == 1 && (e->cmd == cmdtempo || e->cmd == cmdpartbrk);
 }
 
 static ABCEVENT *abc_next_global(ABCEVENT *e)
@@ -2612,7 +2648,7 @@
                                                utrk_write_note(of->ut, n); // 
<- normal note
                                                pt_write_effect(of->ut, 0xc, 
vol);
                                        }
-                                       else { 
+                                       else {
                                                // two notes in one row, use 
FINEPITCHSLIDE runonce effect
                                                // start first note on first 
tick and framedly runonce on seconds note tick
                                                // use volume and instrument of 
last note
@@ -2763,7 +2799,7 @@
                                                m->volcmd = VOLCMD_VOLUME;
                                                m->vol    = vol;
                                        }
-                                       else { 
+                                       else {
                                                // two notes in one row, use 
FINEPITCHSLIDE runonce effect
                                                // start first note on first 
tick and framedly runonce on seconds note tick
                                                // use volume and instrument of 
last note
@@ -2837,7 +2873,7 @@
 static int ABC_Key(const char *p)
 {
        int i,j;
-       char c[8];
+       char c[8] = {0};
        const char *q;
        while( isspace(*p) ) p++;
        i = 0;
@@ -2887,7 +2923,7 @@
        uint32_t tracktime;
        if( tp->tail ) tracktime = tp->tail->tracktick;
        else tracktime = 0;
-       if( tracktime < global_songstart ) 
+       if( tracktime < global_songstart )
                tracktime = global_songstart;
        return tracktime;
 }
@@ -3451,8 +3487,8 @@
 // c. a, b and c must be in the range 0-128. The parameter n determines which
 // notes are "strong". If the time signature is x/y, then each note is given
 // a position number k = 0, 1, 2 .. x-1 within each bar. Note that the units 
for
-// n are not the unit note length. If k is a multiple of n, then the note is 
-// "strong". The volume specifiers !ppp! to !fff! are equivalent to the 
+// n are not the unit note length. If k is a multiple of n, then the note is
+// "strong". The volume specifiers !ppp! to !fff! are equivalent to the
 // following :
 //
 // !ppp! = %%MIDI beat 30 20 10 1
@@ -3482,14 +3518,14 @@
        if( h->beat[3] == 0 ) h->beat[3] = 1; // BB Ruud says: do not let you 
make mad
 }
 
-// 
+//
 // %%MIDI beatstring <string of f, m and p>
-// 
+//
 // This provides an alternative way of specifying where the strong and weak
-// stresses fall within a bar. 'f' means velocity a (normally strong), 'm' 
+// stresses fall within a bar. 'f' means velocity a (normally strong), 'm'
 // means velocity b (medium velocity) and 'p' means velocity c (soft velocity).
-// For example, if the time signature is 7/8 with stresses on the first, 
fourth 
-// and sixth notes in the bar, we could use the following 
+// For example, if the time signature is 7/8 with stresses on the first, fourth
+// and sixth notes in the bar, we could use the following
 //
 // %%MIDI beatstring fppmpmp
 static void abc_MIDI_beatstring(ABCHANDLE *h, const char *p)
@@ -3602,7 +3638,7 @@
                if( tp->slidevol > -2 && slide < 2 )
                        tp->slidevol = slide;
        }
-       if( h->track && h->track->tail 
+       if( h->track && h->track->tail
        && hslide != slide && slide == -2
        && h->track->tail->tracktick >= tracktime ) {
                // need to update jumptypes in mastertrack from tracktime on...
@@ -3666,7 +3702,7 @@
                h->gchordon = abc_MIDI_gchord(p+6, h);
                if( h->gchordon ) --h->gchordon;
                else h->gchordon = t;
-       } 
+       }
        if( !strncmp(p,"gchordoff",9)   && (p[9]=='\0' || p[9]==delim || 
isspace(p[9])) ) h->gchordon = 0;
        if( !strncmp(p,"gchordon",8)    && (p[8]=='\0' || p[8]==delim || 
isspace(p[8])) ) h->gchordon = 1;
        if( t != h->gchordon ) {
@@ -3757,7 +3793,7 @@
        int abcxcount=0, abcxwanted=0, abcxnumber=1;
        int abckey, abcrate, abcchord, abcvol, abcbeatvol, abcnoslurs, 
abcnolegato, abcfermata, abcarpeggio, abcto;
        int abctempo;
-       int cnotelen=0, cnotediv=0, snotelen, snotediv, mnotelen, mnotediv, 
notelen, notediv; 
+       int cnotelen=0, cnotediv=0, snotelen, snotediv, mnotelen, mnotediv, 
notelen, notediv;
        // c for chords, s for standard L: setting, m for M: barlength
        int abchornpipe, brokenrithm, tupletp, tupletq, tupletr;
        int ktempo;
@@ -3999,7 +4035,7 @@
                                                if( snotelen == 0 ) {   // 
calculate default notelen from meter M:
                                                        if( mnotediv == 0 ) 
mnotediv = mnotelen = 1;    // do'nt get nuked
                                                        snotelen = 100 * 
mnotelen / mnotediv;
-                                                       if( snotelen > 74 ) 
+                                                       if( snotelen > 74 )
                                                                snotediv = 8;
                                                        else
                                                                snotediv = 16;
@@ -4039,9 +4075,10 @@
                                                abcstate = INBETWEEN;
                                        break;
                                case INSKIPFORQUOTE:
-                                               while( (ch=*p++) && (ch != '"') 
)
-                                                       ;
-                                               if( !ch ) break;
+                                               while( *p && *p != '"' )
+                                                       p++;
+                                               if( *p == '\0' )
+                                                       break;
                                                abcstate = INBODY;
                                                // fall through
                                case INBODY:
@@ -4226,7 +4263,7 @@
                                                while( p[2]==' ' || p[2]=='.' ) 
p++;    // skip blancs and dots
                                                if( isupper(p[2]) )
                                                        global_part = p[2];
-                                               else 
+                                               else
                                                        global_part = ' ';
                                                if(     global_part == ' ' )
                                                        partpat[26][0] = t;
@@ -4258,17 +4295,18 @@
                                        if( h->tpr ) abc_add_drum_sync(h, 
h->tpr, h->tracktime); // don't start drumming from the beginning of time!
                                }
                                if( h->tpr && !h->drumon ) h->tpr = NULL;
-                               if( *p != '%' ) {       // skip uninteresting 
lines
+                               if( *p && *p != '%' ) { // skip uninteresting 
lines
                                        // plough thru the songline gathering 
mos....
                                        ch0 = ' ';
                                        pp = 0;
                                        while( (ch = *p++) ) {
-                                               if( isalpha(ch) && *p != ':' ) 
{ // maybe a macro
+                                               if( !pp && isalpha(ch) && *p != 
':' ) { // maybe a macro
                                                        for( mp=h->umacro; mp; 
mp=mp->next ) {
                                                                if( ch == 
mp->name[0] ) {
                                                                        pp = p;
                                                                        p = 
mp->subst;
-                                                                       ch = 
*p++;
+                                                                       ch = *p;
+                                    if( ch ) p++;
                                                                        break;
                                                                }
                                                        }
@@ -4312,7 +4350,8 @@
                                                                if( 
!strncmp(p,"P:",2) ) {      // a [P:X] field inline
                                                                        if( 
abcparts != NULL ) {
                                                                                
// make h->tracktime start of a new age...
-                                                                               
abc_add_partbreak(h, h->track, h->tracktime);
+                                                                               
if( h->track )
+                                                                               
        abc_add_partbreak(h, h->track, h->tracktime);
                                                                                
t = abc_patno(h, h->tracktime);
                                                                                
if(     global_part == ' ' )
                                                                                
        partpat[26][1] = t;
@@ -4322,7 +4361,7 @@
                                                                                
while( isspace(p[2]) || p[2]=='.' ) p++;        // skip blancs and dots
                                                                                
if( isupper(p[2]) )
                                                                                
        global_part = p[2];
-                                                                               
else 
+                                                                               
else
                                                                                
        global_part = ' ';
                                                                                
if(     global_part == ' ' )
                                                                                
        partpat[26][0] = t;
@@ -4335,7 +4374,8 @@
                                                                if( 
!strncmp(p,"Q:",2) ) {
                                                                        
abctempo = abc_extract_tempo(p+2,1);
                                                                        for( ; 
*p && *p != ']'; p++ ) ;
-                                                                       
abc_add_tempo_event(h, h->track, h->tracktime, abctempo);
+                                                                       if( 
h->track )
+                                                                               
abc_add_tempo_event(h, h->track, h->tracktime, abctempo);
                                                                        break;
                                                                }
                                                                if( 
!strncmp(p,"I:",2) ) { // interpret some of the possibilitys
@@ -4367,7 +4407,7 @@
                                                                                
p += abc_notelen(p, &notelen, &notediv);
                                                                                
if( *p == '-' ) {
                                                                                
        p++;
-                                                                               
        if( h->tp->tail->flg != 1 )
+                                                                               
        if( h->tp->tail && h->tp->tail->flg != 1 )
                                                                                
        h->tp->tienote = h->tp->tail;
                                                                                
}
                                                                                
if( abcchord<8 ) {
@@ -4411,7 +4451,8 @@
                                                                                
if( thistime > abcticks(h->speed) ) thistime = abcticks(h->speed);
                                                                                
for( nl0=1; nl0<abcchord; nl0++ ) {
                                                                                
        h->tp = abc_locate_track(h, h->tp->v, nl0+DRONEPOS2);
-                                                                               
        h->tp->tail->tracktick = h->tracktime + thistime * nl0;
+                                                                               
        if( h->tp->tail )
+                                                                               
                h->tp->tail->tracktick = h->tracktime + thistime * nl0;
                                                                                
}
                                                                        }       
                                                                        notelen 
*= cnotelen;
@@ -4443,7 +4484,7 @@
                                                                                
                + (thistime * cnl[abcchord] * cnotediv)/(cnd[abcchord] * 
cnotelen) );
                                                                                
}
                                                                                
else {
-                                                                               
        if( ch=='-' && h->tp->tail->flg != 1 )
+                                                                               
        if( ch=='-' && h->tp->tail && h->tp->tail->flg != 1 )
                                                                                
                h->tp->tienote = h->tp->tail;   // copy noteon event to tienote 
in track
                                                                                
        if( thistime > abcticks(h->speed) )
                                                                                
                abc_add_noteoff(h, h->tp, h->tracktime - abcnoslurs);
@@ -4626,8 +4667,7 @@
                                                                if( !ch ) 
abcstate = INSKIPFORQUOTE;
                                                                break;
                                                        case '\\':      // skip 
the rest of this line, should be the end of the line anyway
-                                                               while( 
(ch=*p++) )
-                                                                       ;
+                                                               while( *p ) p++;
                                                                ch = '\\'; // 
remember for invoice tempo changes....
                                                                break;
                                                        case '!':       // line 
break, or deprecated old style decoration
@@ -4837,7 +4877,7 @@
                                                                        p += 
abc_notelen(p, &notelen, &notediv);
                                                                        if( 
*p=='-' ) {
                                                                                
p++;
-                                                                               
if( h->tp->tail->flg != 1 )
+                                                                               
if( h->tp->tail && h->tp->tail->flg != 1 )
                                                                                
h->tp->tienote = h->tp->tail;
                                                                        }
                                                                        tupletr 
= abc_tuplet(&notelen, &notediv, tupletp, tupletq, tupletr);
@@ -4951,7 +4991,7 @@
        ABC_CleanupMacros(h);   // we dont need them anymore
        if( !h->track ) {
                char buf[10];
-               sprintf(buf,"%d",abcxnumber);
+               sprintf(buf,"%u",abcxnumber);
                abc_message("abc X:%s has no body", buf);
                h->track = abc_check_track(h, h->track); // for sanity...
        }
@@ -5045,14 +5085,19 @@
 #else
        m_nType         = MOD_TYPE_ABC;
        numpat          = 1+(modticks(h->tracktime) / h->speed / 64);
+       if( numpat > MAX_PATTERNS )
+               numpat = MAX_PATTERNS;
        m_nDefaultSpeed = h->speed;
        m_nChannels     = abc_numtracks(h);
        m_dwSongFlags   = SONG_LINEARSLIDES;
        m_nMinPeriod    = 28 << 2;
        m_nMaxPeriod    = 1712 << 3;
        // orderlist
-       for(t=0; t < (uint32_t)orderlen; t++)
+       for(t=0; t < (uint32_t)orderlen; t++){
+               if( t >= MAX_ORDERS )
+                       break;
                Order[t] = orderlist[t];
+       }
        free(orderlist);        // get rid of orderlist memory
 #endif
 #ifdef NEWMIKMOD
@@ -5095,6 +5140,8 @@
        }
        // ============================================================
        // set panning positions
+       if( m_nChannels > MAX_BASECHANNELS )
+               m_nChannels = MAX_BASECHANNELS;
        for(t=0; t<m_nChannels; t++) {
                ChnSettings[t].nPan = 0x30+((t+2)%5)*((0xD0 - 0x30)/5);     // 
0x30 = std s3m val
                ChnSettings[t].nVolume = 64;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libmodplug-0.8.8.2/src/load_it.cpp 
new/libmodplug-0.8.8.3/src/load_it.cpp
--- old/libmodplug-0.8.8.2/src/load_it.cpp      2009-05-10 05:05:27.000000000 
+0200
+++ new/libmodplug-0.8.8.3/src/load_it.cpp      2011-05-08 00:25:34.000000000 
+0200
@@ -159,7 +159,6 @@
 BOOL CSoundFile::ReadIT(const BYTE *lpStream, DWORD dwMemLength)
 //--------------------------------------------------------------
 {
-       ITFILEHEADER pifh = *(ITFILEHEADER *)lpStream;
        DWORD dwMemPos = sizeof(ITFILEHEADER);
        DWORD inspos[MAX_INSTRUMENTS];
        DWORD smppos[MAX_SAMPLES];
@@ -167,6 +166,9 @@
        BYTE chnmask[64], channels_used[64];
        MODCOMMAND lastvalue[64];
 
+       if ((!lpStream) || (dwMemLength < sizeof(ITFILEHEADER))) return FALSE;
+       ITFILEHEADER pifh = *(ITFILEHEADER *)lpStream;
+
        pifh.id = bswapLE32(pifh.id);
        pifh.reserved1 = bswapLE16(pifh.reserved1);
        pifh.ordnum = bswapLE16(pifh.ordnum);
@@ -181,7 +183,6 @@
        pifh.msgoffset = bswapLE32(pifh.msgoffset);
        pifh.reserved2 = bswapLE32(pifh.reserved2);
 
-       if ((!lpStream) || (dwMemLength < 0x100)) return FALSE;
        if ((pifh.id != 0x4D504D49) || (pifh.insnum >= MAX_INSTRUMENTS)
         || (!pifh.smpnum) || (pifh.smpnum >= MAX_INSTRUMENTS) || 
(!pifh.ordnum)) return FALSE;
        if (dwMemPos + pifh.ordnum + pifh.insnum*4
@@ -216,7 +217,7 @@
        }
        if (m_nChannels < 4) m_nChannels = 4;
        // Reading Song Message
-       if ((pifh.special & 0x01) && (pifh.msglength) && (pifh.msgoffset + 
pifh.msglength < dwMemLength))
+       if ((pifh.special & 0x01) && (pifh.msglength) && (pifh.msglength <= 
dwMemLength) && (pifh.msgoffset < dwMemLength - pifh.msglength))
        {
                m_lpszSongComments = new char[pifh.msglength+1];
                if (m_lpszSongComments)
@@ -325,11 +326,11 @@
        for (UINT patchk=0; patchk<npatterns; patchk++)
        {
                memset(chnmask, 0, sizeof(chnmask));
-               if ((!patpos[patchk]) || ((DWORD)patpos[patchk] + 4 >= 
dwMemLength)) continue;
+               if ((!patpos[patchk]) || ((DWORD)patpos[patchk] >= dwMemLength 
- 4)) continue;
                UINT len = bswapLE16(*((WORD *)(lpStream+patpos[patchk])));
                UINT rows = bswapLE16(*((WORD *)(lpStream+patpos[patchk]+2)));
                if ((rows < 4) || (rows > 256)) continue;
-               if (patpos[patchk]+8+len > dwMemLength) continue;
+               if (8+len > dwMemLength || patpos[patchk] > dwMemLength - 
(8+len)) continue;
                UINT i = 0;
                const BYTE *p = lpStream+patpos[patchk]+8;
                UINT nrow = 0;
@@ -383,7 +384,7 @@
        // Reading Samples
        m_nSamples = pifh.smpnum;
        if (m_nSamples >= MAX_SAMPLES) m_nSamples = MAX_SAMPLES-1;
-       for (UINT nsmp=0; nsmp<pifh.smpnum; nsmp++) if ((smppos[nsmp]) && 
(smppos[nsmp] + sizeof(ITSAMPLESTRUCT) <= dwMemLength))
+       for (UINT nsmp=0; nsmp<pifh.smpnum; nsmp++) if ((smppos[nsmp]) && 
(smppos[nsmp] <= dwMemLength - sizeof(ITSAMPLESTRUCT)))
        {
                ITSAMPLESTRUCT pis = *(ITSAMPLESTRUCT *)(lpStream+smppos[nsmp]);
                pis.id = bswapLE32(pis.id);
@@ -450,7 +451,7 @@
        // Reading Patterns
        for (UINT npat=0; npat<npatterns; npat++)
        {
-               if ((!patpos[npat]) || ((DWORD)patpos[npat] + 4 >= dwMemLength))
+               if ((!patpos[npat]) || ((DWORD)patpos[npat] >= dwMemLength - 4))
                {
                        PatternSize[npat] = 64;
                        Patterns[npat] = AllocatePattern(64, m_nChannels);
@@ -460,7 +461,7 @@
                UINT len = bswapLE16(*((WORD *)(lpStream+patpos[npat])));
                UINT rows = bswapLE16(*((WORD *)(lpStream+patpos[npat]+2)));
                if ((rows < 4) || (rows > 256)) continue;
-               if (patpos[npat]+8+len > dwMemLength) continue;
+               if (8+len > dwMemLength || patpos[npat] > dwMemLength - 
(8+len)) continue;
                PatternSize[npat] = rows;
                if ((Patterns[npat] = AllocatePattern(rows, m_nChannels)) == 
NULL) continue;
                memset(lastvalue, 0, sizeof(lastvalue));
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libmodplug-0.8.8.2/src/load_med.cpp 
new/libmodplug-0.8.8.3/src/load_med.cpp
--- old/libmodplug-0.8.8.2/src/load_med.cpp     2009-05-11 10:21:30.000000000 
+0200
+++ new/libmodplug-0.8.8.3/src/load_med.cpp     2011-05-01 05:34:21.000000000 
+0200
@@ -664,7 +664,7 @@
                                const MMD2PLAYSEQ *pmps = (MMD2PLAYSEQ 
*)(lpStream + pseq);
                                if (!m_szNames[0][0]) memcpy(m_szNames[0], 
pmps->name, 31);
                                UINT n = bswapBE16(pmps->length);
-                               if (pseq+n <= dwMemLength)
+                               if (n < (dwMemLength - (pseq + sizeof(*pmps)) + 
sizeof(pmps->seq)) / sizeof(pmps->seq[0]))
                                {
                                        for (UINT i=0; i<n; i++)
                                        {
@@ -745,7 +745,7 @@
                                DWORD trktagofs = bswapBE32(ptrktags[i]);
                                if (trktagofs)
                                {
-                                       while (trktagofs+8 < dwMemLength)
+                                       while (trktagofs < dwMemLength - 8)
                                        {
                                                DWORD ntag = bswapBE32(*(DWORD 
*)(lpStream + trktagofs));
                                                if (ntag == MMDTAG_END) break;
@@ -758,7 +758,7 @@
                                                trktagofs += 8;
                                        }
                                        if (trknamelen > MAX_CHANNELNAME) 
trknamelen = MAX_CHANNELNAME;
-                                       if ((trknameofs) && (trknameofs + 
trknamelen < dwMemLength))
+                                       if ((trknameofs) && (trknamelen < 
dwMemLength) && (trknameofs < dwMemLength - trknamelen))
                                        {
                                                lstrcpyn(ChnSettings[i].szName, 
(LPCSTR)(lpStream+trknameofs), MAX_CHANNELNAME);
                                                
ChnSettings[i].szName[MAX_CHANNELNAME-1] = '\0';
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libmodplug-0.8.8.2/src/load_pat.cpp 
new/libmodplug-0.8.8.3/src/load_pat.cpp
--- old/libmodplug-0.8.8.2/src/load_pat.cpp     2011-03-25 23:02:07.000000000 
+0100
+++ new/libmodplug-0.8.8.3/src/load_pat.cpp     2011-05-08 16:44:04.000000000 
+0200
@@ -34,8 +34,12 @@
 #include <math.h>
 #include <ctype.h>
 #ifndef _WIN32
+#include <limits.h> // for PATH_MAX
 #include <unistd.h> // for sleep
 #endif
+#ifndef PATH_MAX
+#define PATH_MAX 256
+#endif
 
 #ifdef NEWMIKMOD
 #include "mikmod.h"
@@ -63,7 +67,8 @@
 
 // 128 gm and 63 drum
 #define MAXSMP                         191
-static char midipat[MAXSMP][40];
+static int isabspath = 0;
+static char midipat[MAXSMP][128];
 static char pathforpat[128];
 static char timiditycfg[128];
 
@@ -356,9 +361,9 @@
 
 void pat_init_patnames(void)
 {
-       int i,j;
+       int i,j, pfnlen, ndir;
        char *p, *q;
-       char line[80];
+       char line[PATH_MAX];
        MMSTREAM *mmcfg;
        strcpy(pathforpat, PATHFORPAT);
        strcpy(timiditycfg, TIMIDITYCFG);
@@ -377,22 +382,34 @@
        else {
                // read in bank 0 and drum patches
                j = 0;
-               _mm_fgets(mmcfg, line, 80);
+               _mm_fgets(mmcfg, line, PATH_MAX);
                while( !_mm_feof(mmcfg) ) {
-                       if( isdigit(line[0]) ) {
+                       if( isdigit(line[0]) || (line[0] == '\t' && 
isdigit(line[1])) ) {
                                i = atoi(line);
                                if( i < MAXSMP && i >= 0 ) {
-                                       p = strchr(line,'/')+1;
+                                       p = strchr(line,'/') + 1;
                                        if(j) 
                                                q = midipat[pat_gm_drumnr(i)-1];
                                        else
                                                q = midipat[i];
-                                       while( *p && !isspace(*p) )     *q++ = 
*p++;
-                                       if( isspace(*p) ) {
+                                       pfnlen = 0;
+                                       ndir = 0;
+                                       while( *p && !isspace(*p) && pfnlen < 
128 ) {
+                                               if (*p == DIRDELIM) ndir++;
+                                               pfnlen ++;
+                                               *q++ = *p++;
+                                       }
+                                       if (ndir > 2) isabspath = 1;
+                                       if( isblank(*p) && *(p+1) != '#' && 
pfnlen < 128 ) {
                                                *q++ = ':';
                                                while( isspace(*p) ) {
                                                        while( isspace(*p) ) 
p++;
-                                                       while( *p && 
!isspace(*p) ) *q++ = *p++;
+                                                       if ( *p == '#' ) { // 
comment
+                                                               
+                                                       } else while( *p && 
!isspace(*p) && pfnlen < 128 ) {
+                                                               pfnlen ++;
+                                                               *q++ = *p++;
+                                                       }
                                                        if( isspace(*p) ) *q++ 
= ' ';
                                                }
                                        }
@@ -400,23 +417,26 @@
                                }
                        }
                        if( !strncmp(line,"drumset",7) ) j = 1;
-                       _mm_fgets(mmcfg, line, 80);
+                       _mm_fgets(mmcfg, line, PATH_MAX);
                }
                _mm_fclose(mmcfg);
        }
        q = midipat[0];
        j = 0;
+       // make all empty patches duplicate the previous valid one.
        for( i=0; i<MAXSMP; i++ )       {
                if( midipat[i][0] ) q = midipat[i];
                else {
-                       strcpy(midipat[i],q);
+                       if( midipat[i] != q)
+                               strcpy(midipat[i],q);
                        if( midipat[i][0] == '\0' ) j++;
                }
        }
        if( j ) {
                for( i=MAXSMP; i-- > 0; )       {
                        if( midipat[i][0] ) q = midipat[i];
-                       else strcpy(midipat[i],q);
+                       else if( midipat[i] != q )
+                               strcpy(midipat[i],q);
                }
        }
 }
@@ -425,12 +445,13 @@
 {
        char *ps;
        ps = strrchr(midipat[pat], ':');
+       
        if( ps ) {
-               sprintf(fname, "%s%c%s", pathforpat, DIRDELIM, midipat[pat]);
+               sprintf(fname, "%s%c%s", isabspath ? "" : pathforpat, DIRDELIM, 
midipat[pat]);
                strcpy(strrchr(fname, ':'), ".pat");
                return ps;
        }
-       sprintf(fname, "%s%c%s.pat", pathforpat, DIRDELIM, midipat[pat]);
+       sprintf(fname, "%s%c%s.pat", isabspath ? "" : pathforpat, DIRDELIM, 
midipat[pat]);
        return 0;
 }
 
@@ -1230,7 +1251,7 @@
 #endif
 {
        WaveHeader hw;
-       char s[32];
+       char s[256];
        sprintf(s, "%d:%s", smp-1, midipat[gm-1]);
 #ifdef NEWMIKMOD
        q->samplename = DupStr(of->allochandle, s,28);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libmodplug-0.8.8.2/src/load_ptm.cpp 
new/libmodplug-0.8.8.3/src/load_ptm.cpp
--- old/libmodplug-0.8.8.2/src/load_ptm.cpp     2011-03-25 23:02:07.000000000 
+0100
+++ new/libmodplug-0.8.8.3/src/load_ptm.cpp     2011-05-08 00:44:11.000000000 
+0200
@@ -67,10 +67,12 @@
 BOOL CSoundFile::ReadPTM(const BYTE *lpStream, DWORD dwMemLength)
 //---------------------------------------------------------------
 {
-       PTMFILEHEADER pfh = *(LPPTMFILEHEADER)lpStream;
        DWORD dwMemPos;
        UINT nOrders;
 
+       if ((!lpStream) || (dwMemLength < sizeof(PTMFILEHEADER))) return FALSE;
+       PTMFILEHEADER pfh = *(LPPTMFILEHEADER)lpStream;
+
        pfh.norders = bswapLE16(pfh.norders);
        pfh.nsamples = bswapLE16(pfh.nsamples);
        pfh.npatterns = bswapLE16(pfh.npatterns);
@@ -83,7 +85,6 @@
                pfh.patseg[j] = bswapLE16(pfh.patseg[j]);
        }
 
-       if ((!lpStream) || (dwMemLength < 1024)) return FALSE;
        if ((pfh.ptmf_id != 0x464d5450) || (!pfh.nchannels)
         || (pfh.nchannels > 32)
         || (pfh.norders > 256) || (!pfh.norders)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libmodplug-0.8.8.2/src/load_s3m.cpp 
new/libmodplug-0.8.8.3/src/load_s3m.cpp
--- old/libmodplug-0.8.8.2/src/load_s3m.cpp     2011-03-25 23:17:18.000000000 
+0100
+++ new/libmodplug-0.8.8.3/src/load_s3m.cpp     2011-05-08 00:17:06.000000000 
+0200
@@ -16,6 +16,7 @@
 //////////////////////////////////////////////////////
 // ScreamTracker S3M file support
 
+#pragma pack(1)
 typedef struct tagS3MSAMPLESTRUCT
 {
        BYTE type;
@@ -182,6 +183,13 @@
        *pprm = param;
 }
 
+static DWORD boundInput(DWORD input, DWORD smin, DWORD smax)
+{
+       if (input > smax) input = smax;
+       else if (input < smin) input = 0;
+       return(input);
+}
+
 
 BOOL CSoundFile::ReadS3M(const BYTE *lpStream, DWORD dwMemLength)
 //---------------------------------------------------------------
@@ -189,9 +197,10 @@
        UINT insnum,patnum,nins,npat;
        DWORD insfile[128];
        WORD ptr[256];
-       BYTE s[1024];
        DWORD dwMemPos;
        BYTE insflags[128], inspack[128];
+
+       if ((!lpStream) || (dwMemLength <= 
sizeof(S3MFILEHEADER)+sizeof(S3MSAMPLESTRUCT)+64)) return FALSE;
        S3MFILEHEADER psfh = *(S3MFILEHEADER *)lpStream;
 
        psfh.reserved1 = bswapLE16(psfh.reserved1);
@@ -204,7 +213,6 @@
        psfh.scrm = bswapLE32(psfh.scrm);
        psfh.special = bswapLE16(psfh.special);
 
-       if ((!lpStream) || (dwMemLength <= 
sizeof(S3MFILEHEADER)+sizeof(S3MSAMPLESTRUCT)+64)) return FALSE;
        if (psfh.scrm != 0x4D524353) return FALSE;
        dwMemPos = 0x60;
        m_nType = MOD_TYPE_S3M;
@@ -284,37 +292,26 @@
        {
                UINT nInd = ((DWORD)ptr[iSmp-1])*16;
                if ((!nInd) || (nInd + 0x50 > dwMemLength)) continue;
-               memcpy(s, lpStream+nInd, 0x50);
-               memcpy(Ins[iSmp].name, s+1, 12);
-               insflags[iSmp-1] = s[0x1F];
-               inspack[iSmp-1] = s[0x1E];
-               s[0x4C] = 0;
-               lstrcpy(m_szNames[iSmp], (LPCSTR)&s[0x30]);
-               if ((s[0]==1) && (s[0x4E]=='R') && (s[0x4F]=='S'))
+               S3MSAMPLESTRUCT pSmp;
+               memcpy(&pSmp, lpStream+nInd, 0x50);
+               memcpy(Ins[iSmp].name, &pSmp.dosname, 12);
+               insflags[iSmp-1] = pSmp.flags;
+               inspack[iSmp-1] = pSmp.pack;
+               memcpy(m_szNames[iSmp], pSmp.name, 28);
+               m_szNames[iSmp][28] = 0;
+               if ((pSmp.type==1) && (pSmp.scrs[2]=='R') && 
(pSmp.scrs[3]=='S'))
                {
-                       UINT j = bswapLE32(*((LPDWORD)(s+0x10)));
-                       if (j > MAX_SAMPLE_LENGTH) j = MAX_SAMPLE_LENGTH;
-                       if (j < 4) j = 0;
-                       Ins[iSmp].nLength = j;
-                       j = bswapLE32(*((LPDWORD)(s+0x14)));
-                       if (j >= Ins[iSmp].nLength) j = Ins[iSmp].nLength - 1;
-                       Ins[iSmp].nLoopStart = j;
-                       j = bswapLE32(*((LPDWORD)(s+0x18)));
-                       if (j > MAX_SAMPLE_LENGTH) j = MAX_SAMPLE_LENGTH;
-                       if (j < 4) j = 0;
-                       if (j > Ins[iSmp].nLength) j = Ins[iSmp].nLength;
-                       Ins[iSmp].nLoopEnd = j;
-                       j = s[0x1C];
-                       if (j > 64) j = 64;
-                       Ins[iSmp].nVolume = j << 2;
+                       Ins[iSmp].nLength = boundInput(bswapLE32(pSmp.length), 
4, MAX_SAMPLE_LENGTH);
+                       Ins[iSmp].nLoopStart = 
boundInput(bswapLE32(pSmp.loopbegin), 4, Ins[iSmp].nLength - 1);
+                       Ins[iSmp].nLoopEnd = 
boundInput(bswapLE32(pSmp.loopend), 4, Ins[iSmp].nLength);
+                       Ins[iSmp].nVolume = boundInput(pSmp.vol, 0, 64) << 2;
                        Ins[iSmp].nGlobalVol = 64;
-                       if (s[0x1F]&1) Ins[iSmp].uFlags |= CHN_LOOP;
-                       j = bswapLE32(*((LPDWORD)(s+0x20)));
+                       if (pSmp.flags&1) Ins[iSmp].uFlags |= CHN_LOOP;
+                       UINT j = bswapLE32(pSmp.finetune);
                        if (!j) j = 8363;
                        if (j < 1024) j = 1024;
                        Ins[iSmp].nC4Speed = j;
-                       insfile[iSmp] = ((DWORD)bswapLE16(*((LPWORD)(s+0x0E)))) 
<< 4;
-                       insfile[iSmp] += ((DWORD)(BYTE)s[0x0D]) << 20;
+                       insfile[iSmp] = (pSmp.hmem << 20) + 
(bswapLE16(pSmp.memseg) << 4);
                        if (insfile[iSmp] > dwMemLength) insfile[iSmp] &= 
0xFFFF;
                        if ((Ins[iSmp].nLoopStart >= Ins[iSmp].nLoopEnd) || 
(Ins[iSmp].nLoopEnd - Ins[iSmp].nLoopStart < 8))
                                Ins[iSmp].nLoopStart = Ins[iSmp].nLoopEnd = 0;
@@ -393,7 +390,8 @@
                if (insflags[iRaw-1] & 2) flags |= RSF_STEREO;
                if (inspack[iRaw-1] == 4) flags = RS_ADPCM4;
                dwMemPos = insfile[iRaw];
-               dwMemPos += ReadSample(&Ins[iRaw], flags, (LPSTR)(lpStream + 
dwMemPos), dwMemLength - dwMemPos);
+               if (dwMemPos < dwMemLength)
+                       dwMemPos += ReadSample(&Ins[iRaw], flags, 
(LPSTR)(lpStream + dwMemPos), dwMemLength - dwMemPos);
        }
        m_nMinPeriod = 64;
        m_nMaxPeriod = 32767;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libmodplug-0.8.8.2/src/sndfile.cpp 
new/libmodplug-0.8.8.3/src/sndfile.cpp
--- old/libmodplug-0.8.8.2/src/sndfile.cpp      2011-03-25 23:02:07.000000000 
+0100
+++ new/libmodplug-0.8.8.3/src/sndfile.cpp      2011-05-01 05:34:20.000000000 
+0200
@@ -1550,7 +1550,9 @@
 //----------------------------------------------------
 {
        if (!pIns->pSample) return;
+       if (pIns->nLength > MAX_SAMPLE_LENGTH) pIns->nLength = 
MAX_SAMPLE_LENGTH;
        if (pIns->nLoopEnd > pIns->nLength) pIns->nLoopEnd = pIns->nLength;
+       if (pIns->nLoopStart > pIns->nLength+2) pIns->nLoopStart = 
pIns->nLength+2;
        if (pIns->nLoopStart+2 >= pIns->nLoopEnd)
        {
                pIns->nLoopStart = pIns->nLoopEnd = 0;


++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



Remember to have fun...

-- 
To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org
For additional commands, e-mail: opensuse-commit+h...@opensuse.org

Reply via email to