[libmikmod] Fix a crash in align_pointer() (rhbz#855130)
Hans de Goede
jwrdegoede at fedoraproject.org
Sat Sep 8 15:30:42 UTC 2012
commit 8b2165f04c75c0afb619d2fb7cf06678c0a69e25
Author: Hans de Goede <hdegoede at redhat.com>
Date: Sat Sep 8 17:29:11 2012 +0200
Fix a crash in align_pointer() (rhbz#855130)
libmikmod-malloc-fail.patch | 20 ++++++++++++++++++++
libmikmod.spec | 8 +++++++-
2 files changed, 27 insertions(+), 1 deletions(-)
---
diff --git a/libmikmod-malloc-fail.patch b/libmikmod-malloc-fail.patch
new file mode 100644
index 0000000..bf64194
--- /dev/null
+++ b/libmikmod-malloc-fail.patch
@@ -0,0 +1,20 @@
+Some partially corrupt mod files cause mikmod to try and allocate lots
+of memory, this is ok, because failure to do so is being handled.
+
+But the new libmikmod malloc code align_pointer function did not handle
+asking to align the NULL pointer, resulting from the too big alloc,
+causing a segfault, this patch fixes this.
+diff -up libmikmod-3.2.0/mmio/mmalloc.c~ libmikmod-3.2.0/mmio/mmalloc.c
+--- libmikmod-3.2.0/mmio/mmalloc.c~ 2012-03-14 18:02:59.000000000 +0100
++++ libmikmod-3.2.0/mmio/mmalloc.c 2012-09-08 17:23:36.528824523 +0200
+@@ -38,6 +38,10 @@ static void * align_pointer(char *ptr, s
+ {
+ char *pptr = ptr + sizeof(void*);
+ char *fptr;
++
++ if (ptr == NULL)
++ return NULL;
++
+ size_t err = ((size_t)pptr)&(stride-1);
+ if (err)
+ fptr = pptr + (stride - err);
diff --git a/libmikmod.spec b/libmikmod.spec
index e5857ce..b33609b 100644
--- a/libmikmod.spec
+++ b/libmikmod.spec
@@ -1,7 +1,7 @@
Summary: A MOD music file player library
Name: libmikmod
Version: 3.2.0
-Release: 17%{?dist}
+Release: 18%{?dist}
License: GPLv2 and LGPLv2+
Group: Applications/Multimedia
URL: http://http://mikmod.shlomifish.org/
@@ -15,6 +15,8 @@ Patch6: libmikmod-CVE-2007-6720.patch
Patch7: libmikmod-CVE-2009-0179.patch
# Fix rhbz#845782
Patch8: libmikmod-Player_Start-crash.patch
+# Fix rhbz#855130
+Patch9: libmikmod-malloc-fail.patch
BuildRequires: alsa-lib-devel
@@ -45,6 +47,7 @@ applications for mikmod.
%patch6 -p1 -b .CVE-2007-6720
%patch7 -p1 -b .CVE-2009-0179
%patch8 -p1
+%patch9 -p1
%build
%configure --enable-dl --disable-altivec --enable-alsa
@@ -80,6 +83,9 @@ fi
%{_mandir}/man1/libmikmod-config*
%changelog
+* Sat Sep 8 2012 Hans de Goede <hdegoede at redhat.com> - 3.2.0-18
+- Fix a crash in align_pointer() (rhbz#855130)
+
* Sun Aug 5 2012 Hans de Goede <hdegoede at redhat.com> - 3.2.0-17
- Fix a crash in Player_Start() (rhbz#845782)
More information about the scm-commits
mailing list