diff --git a/README.md b/README.md index 472d527..55c4d79 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,5 @@ # libmikmod +Libmikmod is a sound library capable of playing audio samples as well as tracker modules. +Supported module formats include MOD, S3M, XM, IT, MED, MTM and 669. + diff --git a/libmikmod-3.1.11-configure.patch b/libmikmod-3.1.11-configure.patch new file mode 100644 index 0000000..01b4ea2 --- /dev/null +++ b/libmikmod-3.1.11-configure.patch @@ -0,0 +1,32 @@ +diff -Nru libmikmod-3.1.11.orig/configure libmikmod-3.1.11/configure +--- libmikmod-3.1.11.orig/configure 2005-08-03 18:36:45.000000000 +0200 ++++ libmikmod-3.1.11/configure 2005-08-03 18:36:50.000000000 +0200 +@@ -6207,8 +6207,8 @@ + # ----------------- + if test "`uname`" = "Linux" && test $libmikmod_driver_alsa = yes + then +- libmikmod_driver_alsa=no +- for ac_hdr in sys/asoundlib.h ++ libmikmod_driver_alsa=yes ++ for ac_hdr in alsa/asoundlib.h + do + ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` + echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +@@ -6248,7 +6248,7 @@ + fi + done + +- if test $ac_cv_header_sys_asoundlib_h = yes ++ if test $ac_cv_header_alsa_asoundlib_h = yes + then + echo $ac_n "checking for snd_cards in -lasound""... $ac_c" 1>&6 + echo "configure:6255: checking for snd_cards in -lasound" >&5 +@@ -8651,7 +8651,7 @@ + # Print configuration. + # ==================== + +-libmikmod_driverlist=`echo $libmikmod_driverlist raw wav pipe stdout nosound|sed -e 's, , ,g'` ++libmikmod_driverlist=`echo $libmikmod_driverlist wav pipe stdout nosound|sed -e 's, , ,g'` + if test $libmikmod_dynload != no + then + libmikmod_dynload="yes, ${libmikmod_dynload} style" diff --git a/libmikmod-3.1.11-dspbusy.patch b/libmikmod-3.1.11-dspbusy.patch new file mode 100644 index 0000000..c9ed972 --- /dev/null +++ b/libmikmod-3.1.11-dspbusy.patch @@ -0,0 +1,12 @@ +diff -pur libmikmod-3.1.11/drivers/drv_oss.c libmikmod-3.1.11-fix/drivers/drv_oss.c +--- libmikmod-3.1.11/drivers/drv_oss.c 2005-08-04 10:41:29.000000000 +0200 ++++ libmikmod-3.1.11-fix/drivers/drv_oss.c 2005-08-04 10:50:24.000000000 +0200 +@@ -160,7 +160,7 @@ static BOOL OSS_IsThere(void) + in the kernel or sound hardware */ + int fd; + +- if((fd=open(OSS_GetDeviceName(),O_WRONLY))>=0) { ++ if((fd=open(OSS_GetDeviceName(),O_WRONLY|O_NONBLOCK))>=0) { + close(fd); + return 1; + } diff --git a/libmikmod-3.1.11-esd_dlopen.patch b/libmikmod-3.1.11-esd_dlopen.patch new file mode 100644 index 0000000..c7dad1c --- /dev/null +++ b/libmikmod-3.1.11-esd_dlopen.patch @@ -0,0 +1,14 @@ +diff -pur libmikmod-3.1.11/drivers/drv_esd.c libmikmod-3.1.11-fix/drivers/drv_esd.c +--- libmikmod-3.1.11/drivers/drv_esd.c 2005-08-04 11:06:31.000000000 +0200 ++++ libmikmod-3.1.11-fix/drivers/drv_esd.c 2005-08-04 11:07:43.000000000 +0200 +@@ -99,8 +99,8 @@ static BOOL ESD_Link(void) + { + if (libesd) return 0; + +- /* load libesd.so */ +- libesd=dlopen("libesd.so",RTLD_LAZY|RTLD_GLOBAL); ++ /* load libesd.so.0 */ ++ libesd=dlopen("libesd.so.0",RTLD_LAZY|RTLD_GLOBAL); + if (!libesd) return 1; + + /* resolve function references */ diff --git a/libmikmod-3.1.11-exec_lib.patch b/libmikmod-3.1.11-exec_lib.patch new file mode 100644 index 0000000..fa0523d --- /dev/null +++ b/libmikmod-3.1.11-exec_lib.patch @@ -0,0 +1,12 @@ +diff -ru libmikmod-3.1.11/libmikmod/Makefile.in libmikmod-3.1.11-fix/libmikmod/Makefile.in +--- libmikmod-3.1.11/libmikmod/Makefile.in 2004-01-21 18:43:52.000000000 +0100 ++++ libmikmod-3.1.11-fix/libmikmod/Makefile.in 2005-08-04 10:34:18.000000000 +0200 +@@ -51,7 +51,7 @@ + + install: $(LIB) + $(MKINSTALLDIRS) $(DESTDIR)$(libdir) +- $(LIBTOOL) --mode=install $(INSTALL) -m 644 $(LIB) $(DESTDIR)$(libdir) ++ $(LIBTOOL) --mode=install $(INSTALL) -m 755 $(LIB) $(DESTDIR)$(libdir) + + uninstall: $(LIB) + $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$(LIB) diff --git a/libmikmod-3.1.11-musicraw_creation.patch b/libmikmod-3.1.11-musicraw_creation.patch new file mode 100644 index 0000000..bb69b60 --- /dev/null +++ b/libmikmod-3.1.11-musicraw_creation.patch @@ -0,0 +1,80 @@ +diff -pur libmikmod-3.1.11/drivers/drv_raw.c libmikmod-3.1.11-fix/drivers/drv_raw.c +--- libmikmod-3.1.11/drivers/drv_raw.c 2005-08-04 11:49:52.000000000 +0200 ++++ libmikmod-3.1.11-fix/drivers/drv_raw.c 2005-08-04 17:25:37.000000000 +0200 +@@ -42,10 +42,11 @@ + #include + #endif + ++#include ++ + #include "mikmod_internals.h" + + #define BUFFERSIZE 32768 +-#define FILENAME "music.raw" + + #ifndef O_BINARY + #define O_BINARY 0 +@@ -58,6 +59,7 @@ + static int rawout=-1; + static SBYTE *audiobuffer=NULL; + static CHAR *filename=NULL; ++static CHAR tmpf_pattern[]="/tmp/music_raw.XXXXXX"; + + static void RAW_CommandLine(CHAR *cmdline) + { +@@ -76,14 +78,28 @@ static BOOL RAW_IsThere(void) + + static BOOL RAW_Init(void) + { ++ int temp_fd; ++ mode_t old_mode; ++ ++ if (!filename) { ++ temp_fd = mkstemp(tmpf_pattern); ++ old_mode = umask(077); ++ (void) umask(old_mode); ++ if (temp_fd == -1) { ++ _mm_errno=MMERR_OPENING_FILE; ++ return 1; ++ } ++ filename=tmpf_pattern; ++ } ++ + #if defined unix || (defined __APPLE__ && defined __MACH__) +- if(!MD_Access(filename?filename:FILENAME)) { ++ if(!MD_Access(filename)) { + _mm_errno=MMERR_OPENING_FILE; + return 1; + } + #endif + +- if((rawout=open(filename?filename:FILENAME,O_RDWR|O_TRUNC|O_CREAT|O_BINARY ++ if((rawout=open(filename,O_RDWR|O_TRUNC|O_CREAT|O_BINARY + #if !defined(macintosh) && !defined(__MWERKS__) + ,S_IREAD|S_IWRITE + #endif +@@ -94,13 +110,13 @@ static BOOL RAW_Init(void) + md_mode|=DMODE_SOFT_MUSIC|DMODE_SOFT_SNDFX; + + if (!(audiobuffer=(SBYTE*)_mm_malloc(BUFFERSIZE))) { +- close(rawout);unlink(filename?filename:FILENAME); ++ close(rawout);unlink(filename); + rawout=-1; + return 1; + } + + if ((VC_Init())) { +- close(rawout);unlink(filename?filename:FILENAME); ++ close(rawout);unlink(filename); + rawout=-1; + return 1; + } +@@ -125,7 +141,7 @@ static void RAW_Update(void) + static BOOL RAW_Reset(void) + { + close(rawout); +- if((rawout=open(filename?filename:FILENAME,O_RDWR|O_TRUNC|O_CREAT|O_BINARY ++ if((rawout=open(filename,O_RDWR|O_TRUNC|O_CREAT|O_BINARY + #if !defined(macintosh) && !defined(__MWERKS__) + ,S_IREAD|S_IWRITE + #endif diff --git a/libmikmod-3.1.12-CVE_2007_6720.patch b/libmikmod-3.1.12-CVE_2007_6720.patch new file mode 100644 index 0000000..45cc355 --- /dev/null +++ b/libmikmod-3.1.12-CVE_2007_6720.patch @@ -0,0 +1,112 @@ +This patch fixes "buffer overflow due to md_numchn - ID: 1630158" + +diff -ru libmikmod-3.1.12.orig/playercode/mplayer.c libmikmod-3.1.12/playercode/mplayer.c +--- libmikmod-3.1.12.orig/playercode/mplayer.c 2007-12-15 01:26:28.000000000 -0800 ++++ libmikmod-3.1.12/playercode/mplayer.c 2009-10-04 23:48:36.000000000 -0700 +@@ -52,6 +52,8 @@ + will wait */ + /*static*/ MODULE *pf = NULL; + ++#define NUMVOICES(mod) (md_sngchn < (mod)->numvoices ? md_sngchn : (mod)->numvoices) ++ + #define HIGH_OCTAVE 2 /* number of above-range octaves */ + + static UWORD oldperiods[OCTAVE*2]={ +@@ -248,14 +250,14 @@ + MP_VOICE *a; + ULONG t,k,tvol,pp; + +- for (t=0;tvoice[t].main.kick==KICK_ABSENT)|| + (mod->voice[t].main.kick==KICK_ENV))&& + Voice_Stopped_internal(t)) + return t; + + tvol=0xffffffUL;t=-1;a=mod->voice; +- for (k=0;kmain.s) + return k; +@@ -2249,12 +2251,12 @@ + + switch (dat) { + case 0x0: /* past note cut */ +- for (t=0;tvoice[t].master==a) + mod->voice[t].main.fadevol=0; + break; + case 0x1: /* past note off */ +- for (t=0;tvoice[t].master==a) { + mod->voice[t].main.keyoff|=KEY_OFF; + if ((!(mod->voice[t].venv.flg & EF_ON))|| +@@ -2263,7 +2265,7 @@ + } + break; + case 0x2: /* past note fade */ +- for (t=0;tvoice[t].master==a) + mod->voice[t].main.keyoff|=KEY_FADE; + break; +@@ -2318,7 +2320,7 @@ + SAMPLE *s; + + mod->totalchn=mod->realchn=0; +- for (channel=0;channelvoice[channel]; + i=aout->main.i; + s=aout->main.s; +@@ -2736,7 +2738,7 @@ + if (a->dct!=DCT_OFF) { + int t; + +- for (t=0;tvoice[t].masterchn==channel)&& + (a->main.sample==mod->voice[t].main.sample)) { +@@ -2978,6 +2980,11 @@ + if (!(mod->voice=(MP_VOICE*)_mm_calloc(md_sngchn,sizeof(MP_VOICE)))) + return 1; + ++ /* mod->numvoices was used during loading to clamp md_sngchn. ++ After loading it's used to remember how big mod->voice is. ++ */ ++ mod->numvoices = md_sngchn; ++ + Player_Init_internal(mod); + return 0; + } +@@ -3086,7 +3093,7 @@ + pf->patbrk=0; + pf->vbtick=pf->sngspd; + +- for (t=0;tvoice[t].main.i=NULL; + pf->voice[t].main.s=NULL; +@@ -3111,7 +3118,7 @@ + pf->patbrk=0; + pf->vbtick=pf->sngspd; + +- for (t=0;tvoice[t].main.i=NULL; + pf->voice[t].main.s=NULL; +@@ -3138,7 +3145,7 @@ + pf->sngpos=pos; + pf->vbtick=pf->sngspd; + +- for (t=0;tvoice[t].main.i=NULL; + pf->voice[t].main.s=NULL; diff --git a/libmikmod-3.1.12-CVE_2009_0179.patch b/libmikmod-3.1.12-CVE_2009_0179.patch new file mode 100644 index 0000000..0c47e65 --- /dev/null +++ b/libmikmod-3.1.12-CVE_2009_0179.patch @@ -0,0 +1,33 @@ +diff -ur libmikmod-3.1.11.orig/loaders/load_xm.c libmikmod-3.1.11/loaders/load_xm.c +--- libmikmod-3.1.11.orig/loaders/load_xm.c 2004-01-21 18:43:53.000000000 +0100 ++++ libmikmod-3.1.11/loaders/load_xm.c 2008-04-16 04:30:45.000000000 +0200 +@@ -622,7 +622,8 @@ + /* read the remainder of the header */ + for(u=headend-_mm_ftell(modreader);u;u--) _mm_read_UBYTE(modreader); + +- if(_mm_eof(modreader)) { ++ /* last instrument is at the end of file in version 0x0104 */ ++ if(_mm_eof(modreader) && (mh->version<0x0104 || tInit || l->Init()) { + _mm_rewind(modreader); + ok = l->Load(curious); +- /* propagate inflags=flags for in-module samples */ +- for (t = 0; t < of.numsmp; t++) +- if (of.samples[t].inflags == 0) +- of.samples[t].inflags = of.samples[t].flags; ++ if (ok) { ++ /* propagate inflags=flags for in-module samples */ ++ for (t = 0; t < of.numsmp; t++) ++ if (of.samples[t].inflags == 0) ++ of.samples[t].inflags = of.samples[t].flags; ++ } + } else + ok = 0; + diff --git a/libmikmod-3.3.3-texinfo-5.patch b/libmikmod-3.3.3-texinfo-5.patch new file mode 100644 index 0000000..088d9e4 --- /dev/null +++ b/libmikmod-3.3.3-texinfo-5.patch @@ -0,0 +1,66 @@ +--- libmikmod-3.3.3/docs/mikmod.texi.orig 2013-10-15 11:50:02.000000000 +0200 ++++ libmikmod-3.3.3/docs/mikmod.texi 2013-11-17 16:28:07.209526343 +0100 +@@ -1803,6 +1803,7 @@ + @item Result + @itemx 0 + Sound mixing is ready. ++@item Result + @itemx nonzero + An error occurred during the operation. + @item Notes +@@ -1890,6 +1891,7 @@ + @item Result + @itemx 0 + Initialization was successful. ++@item Result + @itemx nonzero + An error occurred during initialization. + @item Notes +@@ -1910,6 +1912,7 @@ + @item Result + @itemx 0 + The library is not thread-safe. ++@item Result + @itemx 1 + The library is thread-safe. + @item Notes +@@ -2096,6 +2099,7 @@ + @item Result + @itemx 0 + Reinitialization was successful. ++@item Result + @itemx nonzero + An error occurred during reinitialization. + @item Notes +@@ -2124,6 +2128,7 @@ + @item Result + @itemx 0 + Initialization was successful. ++@item Result + @itemx nonzero + An error occurred during initialization. + @item Notes +@@ -2211,6 +2216,7 @@ + @item Result + @itemx 0 + No module is playing. ++@item Result + @itemx nonzero + A module is currently playing. + @item Notes +@@ -2424,6 +2430,7 @@ + @item Result + @itemx 0 + The channel is not muted. ++@item Result + @itemx 1 + The channel is muted. + @item See also +@@ -2941,6 +2948,7 @@ + @item Result + @itemx 0 + The voice is stopped or has no sample assigned. ++@item Result + @itemx nonzero + The voice is playing a sample. + @item Notes diff --git a/libmikmod.spec b/libmikmod.spec new file mode 100644 index 0000000..f4a6e65 --- /dev/null +++ b/libmikmod.spec @@ -0,0 +1,133 @@ +### AUTOUPDATE-OFF: 9 +Name: libmikmod +Version: 3.3.6 +Release: 1mamba +Summary: Library supporting many sound formats +Group: System/Libraries +Vendor: openmamba +Distribution: openmamba +Packager: Tiziana Ferro +URL: http://mikmod.raphnet.net +Source: http://downloads.sourceforge.net/project/mikmod/libmikmod/%{version}/libmikmod-%{version}.tar.gz +Patch1: %{name}-3.1.11-configure.patch +Patch2: %{name}-3.1.11-exec_lib.patch +Patch3: %{name}-3.1.11-dspbusy.patch +Patch4: %{name}-3.1.11-esd_dlopen.patch +Patch5: %{name}-3.1.11-musicraw_creation.patch +Patch6: %{name}-3.1.12-CVE_2007_6720.patch +Patch7: %{name}-3.1.12-CVE_2009_0179.patch +Patch8: libmikmod-3.3.3-texinfo-5.patch +License: LGPL +BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot +Requires(post):%{__install_info} +## AUTOBUILDREQ-BEGIN +BuildRequires: glibc-devel +BuildRequires: libaudiofile-devel +## AUTOBUILDREQ-END +BuildRequires: libalsa-devel +BuildRequires: libesound-devel +BuildRequires: automake +BuildRequires: autoconf + +#checking for AF/AFlib.h... no +#checking for libgus.h... no + +%description +Libmikmod is a sound library capable of playing audio samples as well as tracker modules. +Supported module formats include MOD, S3M, XM, IT, MED, MTM and 669. + +%package devel +Group: Development/Libraries +Summary: Static libraries and headers for %{name} +Requires: %{name} = %{version} + +%description devel +Libmikmod is a sound library capable of playing audio samples as well as tracker modules. +Supported module formats include MOD, S3M, XM, IT, MED, MTM and 669. +This package contains static libraries and header files need for development. + +%prep +%setup -q +#%patch1 -p1 -b .configure +#%patch2 -p1 -b .exec_lib +#%patch3 -p1 -b .dspbusy +#%patch4 -p1 -b .esd_dlopen +#%patch5 -p1 -b .musicraw_creation +#%patch6 -p1 +#%patch7 -p1 +#%patch8 -p1 + +%build +%cmake -d build +%make + +%install +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" +%makeinstall -C build + +%clean +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" + +%post -p /sbin/ldconfig +%postun -p /sbin/ldconfig + +%post devel +%install_info mikmod.info + +%preun devel +%uninstall_info mikmod.info +exit 0 + +%files +%defattr(-,root,root) +%{_libdir}/libmikmod.so.* +%doc AUTHORS COPYING.LESSER COPYING.LIB + +%files devel +%defattr(-,root,root) +%{_bindir}/libmikmod-config +#%{_datadir}/aclocal/libmikmod.m4 +%{_includedir}/mikmod.h +%{_libdir}/libmikmod.a +#%{_libdir}/libmikmod.la +%{_libdir}/libmikmod.so +#%{_infodir}/mikmod.* +#%{_mandir}/man1/libmikmod-config.* +%{_libdir}/pkgconfig/libmikmod.pc +%doc NEWS README TODO + +%changelog +* Wed Mar 26 2014 Automatic Build System 3.3.6-1mamba +- automatic version update by autodist + +* Sun Jan 12 2014 Automatic Build System 3.3.5-1mamba +- automatic version update by autodist + +* Mon Dec 09 2013 Automatic Build System 3.3.4-1mamba +- automatic version update by autodist + +* Fri Oct 18 2013 Automatic Build System 3.3.3-1mamba +- update to 3.3.3 + +* Thu Jan 10 2013 Automatic Build System 3.3.1-1mamba +- update to 3.3.1 + +* Sat Jul 21 2012 Automatic Build System 3.2.0-1mamba +- update to 3.2.0 + +* Sun Jul 04 2010 Davide Madrisan 3.1.12-1mamba +- update to 3.1.12 +- fix security issues CVE-2007_6720 and CVE-2009-0179 + +* Thu Jun 26 2008 Tiziana Ferro 3.1.11-3mamba +- add prereq +- update Vendor, Distribution, mantainer, buildrequirements list + +* Wed Aug 03 2005 Silvan Calarco 3.1.11-2qilnx +- alsa patch cleanups +- install/uninstall info page +- patched to create the music.raw file in the temporary directory in a + secure way + +* Fri Dec 17 2004 Massimo Pintore 3.1.11-1qilnx +- package created by autospec