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
This commit is contained in:
Max Kellermann 2018-02-09 19:01:12 +01:00
parent c801936e53
commit 6de92bb42b
2 changed files with 3 additions and 1 deletions

2
NEWS
View File

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

View File

@ -88,7 +88,7 @@ static inline ConstBuffer<V>
ToAlsaChannelOrder71(PcmBuffer &buffer, ConstBuffer<V> src)
{
auto dest = buffer.GetT<V>(src.size);
ToAlsaChannelOrder71(dest, src.data, src.size / 6);
ToAlsaChannelOrder71(dest, src.data, src.size / 8);
return { dest, src.size };
}