From 6de92bb42bb61e7eb849bd554429579d6c61a77e Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 9 Feb 2018 19:01:12 +0100 Subject: [PATCH] pcm/Order: fix size calculation with 8 channels This was a buffer overflow bug which could cause MPD crahes when playing back 8 channels with the ALSA output plugin. Closes #216 --- NEWS | 2 ++ src/pcm/Order.cxx | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index b11108401..b9057693d 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,6 @@ ver 0.20.17 (not yet released) +* output + - alsa: fix crash bug with 8 channels * fix real-time and idle scheduling with Musl ver 0.20.16 (2018/02/03) diff --git a/src/pcm/Order.cxx b/src/pcm/Order.cxx index 1812b14dd..736eb472d 100644 --- a/src/pcm/Order.cxx +++ b/src/pcm/Order.cxx @@ -88,7 +88,7 @@ static inline ConstBuffer ToAlsaChannelOrder71(PcmBuffer &buffer, ConstBuffer src) { auto dest = buffer.GetT(src.size); - ToAlsaChannelOrder71(dest, src.data, src.size / 6); + ToAlsaChannelOrder71(dest, src.data, src.size / 8); return { dest, src.size }; }