moc: fix crash when playing AAC on musl

This moves a buffer (currently 36 KiB) to the heap, avoiding stack
overflow on musl.
This commit is contained in:
Matthias von Faber 2018-02-10 23:55:19 +01:00 committed by Toyam Cox
parent b5c5858ecd
commit 41109a27f3
2 changed files with 29 additions and 1 deletions

View file

@ -0,0 +1,28 @@
--- 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)

View file

@ -1,7 +1,7 @@
# Template file for 'moc'
pkgname=moc
version=2.5.2
revision=1
revision=2
build_style=gnu-configure
hostmakedepends="pkg-config"
makedepends="db-devel ncurses-devel libcurl-devel popt-devel ffmpeg-devel