summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'media-libs/libmikmod/files/3.2.0/004_all_malloc-fail.patch')
-rw-r--r--media-libs/libmikmod/files/3.2.0/004_all_malloc-fail.patch22
1 files changed, 22 insertions, 0 deletions
diff --git a/media-libs/libmikmod/files/3.2.0/004_all_malloc-fail.patch b/media-libs/libmikmod/files/3.2.0/004_all_malloc-fail.patch
new file mode 100644
index 000000000000..9214df87d72e
--- /dev/null
+++ b/media-libs/libmikmod/files/3.2.0/004_all_malloc-fail.patch
@@ -0,0 +1,22 @@
+http://pkgs.fedoraproject.org/cgit/libmikmod.git/tree/libmikmod-malloc-fail.patch
+
+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.
+
+--- mmio/mmalloc.c
++++ mmio/mmalloc.c
+@@ -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);