| 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); |