From c1c68a6914e54a16ad99dcc60833210fca4bb64a Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Sat, 15 May 2010 05:47:06 +0300 Subject: [PATCH] ad_pcm: fix crash at EOF Fix use of unsigned type where negative values were needed. When playing a file with multichannel PCM audio the bug could result in the channel reorder function scrambling memory at the end of playback, causing a crash. --- libmpcodecs/ad_pcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libmpcodecs/ad_pcm.c b/libmpcodecs/ad_pcm.c index b4d8a3f348..6df408abd3 100644 --- a/libmpcodecs/ad_pcm.c +++ b/libmpcodecs/ad_pcm.c @@ -151,7 +151,7 @@ static int control(sh_audio_t * sh, int cmd, void *arg, ...) static int decode_audio(sh_audio_t * sh_audio, unsigned char *buf, int minlen, int maxlen) { - unsigned len = sh_audio->channels * sh_audio->samplesize; + int len = sh_audio->channels * sh_audio->samplesize; minlen = (minlen + len - 1) / len * len; if (minlen > maxlen) // if someone needs hundreds of channels adjust audio_out_minsize