[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openbsd-ports
Subject:    audio/mikmod: fix bug causing ri-li crash
From:       Stefan Sperling <stsp () openbsd ! org>
Date:       2012-12-31 0:50:58
Message-ID: 20121231005057.GC27130 () ted ! stsp ! name
[Download RAW message or body]

games/ri-li crashes when a game is started because our libmikmod port
is missing a fix which is already present in the upstream code.

Perhaps mikmod should be updated but I'd rather just fix this for now.
The crash happens because of.samples is NULL when dereferenced.

While here, make this port honour custom CFLAGS during the build
so that 'make DEBUG="-g"' works.

ok?

Index: Makefile
===================================================================
RCS file: /cvs/ports/audio/libmikmod/Makefile,v
retrieving revision 1.22
diff -u -p -r1.22 Makefile
--- Makefile	10 Aug 2012 20:11:41 -0000	1.22
+++ Makefile	31 Dec 2012 00:44:34 -0000
@@ -4,7 +4,7 @@ COMMENT=	mikmod sound library
 
 VERSION=	3.1.10
 DISTNAME=	libmikmod-${VERSION}
-REVISION=	9
+REVISION=	10
 SHARED_LIBS +=	mikmod               2.4      # .2.4
 CATEGORIES=    	audio devel
 
@@ -25,7 +25,7 @@ WANTLIB=	sndio
 SEPARATE_BUILD=	Yes
 CONFIGURE_STYLE= gnu
 USE_LIBTOOL=	Yes
-CONFIGURE_ENV=	CFLAGS="-DDRV_SNDIO" LIBRARY_LIB="-lsndio"
+CONFIGURE_ENV=	CFLAGS="-DDRV_SNDIO ${CFLAGS}" LIBRARY_LIB="-lsndio"
 CONFIGURE_ARGS+= ${CONFIGURE_SHARED}
 CONFIGURE_ARGS+= --disable-dl \
 		 --disable-oss \
Index: patches/patch-playercode_mloader_c
===================================================================
RCS file: patches/patch-playercode_mloader_c
diff -N patches/patch-playercode_mloader_c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-playercode_mloader_c	31 Dec 2012 00:31:48 -0000
@@ -0,0 +1,20 @@
+$OpenBSD$
+--- playercode/mloader.c.orig	Mon Dec 31 01:30:02 2012
++++ playercode/mloader.c	Mon Dec 31 01:30:54 2012
+@@ -450,10 +450,12 @@ MODULE* Player_LoadGeneric_internal(MREADER *reader,in
+ 	if (!l->Init || 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;
+ 

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic