void-packages/srcpkgs/moc/patches/move-pcm-buffer-to-heap.patch
Matthias von Faber 41109a27f3 moc: fix crash when playing AAC on musl
This moves a buffer (currently 36 KiB) to the heap, avoiding stack
overflow on musl.
2018-02-20 22:40:15 -05:00

28 lines
710 B
Diff

--- player.c 2018-02-10 23:53:38.627091352 +0100
+++ player.c 2018-02-10 23:54:46.672519217 +0100
@@ -444,7 +444,7 @@
{
bool eof = false;
bool stopped = false;
- char buf[PCM_BUF_SIZE];
+ char *const buf = xmalloc (PCM_BUF_SIZE);
int decoded = 0;
struct sound_params new_sound_params;
bool sound_params_change = false;
@@ -486,7 +486,7 @@
status_msg ("Playing...");
}
- decoded = f->decode (decoder_data, buf, sizeof(buf),
+ decoded = f->decode (decoder_data, buf, PCM_BUF_SIZE,
&new_sound_params);
if (decoded)
@@ -629,6 +629,7 @@
precache.f->close (precache.decoder_data);
precache_reset (&precache);
}
+ free (buf);
}
#if !defined(NDEBUG) && defined(DEBUG)