Commit 29a7b2c5 authored by Max Kellermann's avatar Max Kellermann

decoder/mpcdec: ignore empty frames

https://bugs.musicpd.org/view.php?id=4656 describes a crash due to division by zero because frame.samples==0. This should never happen, but apparently can happen after seeking. The best we can do is to just ignore this frame.
parent 3b6c285c
ver 0.20.6 (not yet released) ver 0.20.6 (not yet released)
* decoder
- mpcdec: fix crash (division by zero) after seeking
ver 0.20.5 (2017/02/20) ver 0.20.5 (2017/02/20)
* tags * tags
......
...@@ -207,6 +207,15 @@ mpcdec_decode(DecoderClient &client, InputStream &is) ...@@ -207,6 +207,15 @@ mpcdec_decode(DecoderClient &client, InputStream &is)
if (frame.bits == -1) if (frame.bits == -1)
break; break;
if (frame.samples <= 0) {
/* empty frame - this has been observed to
happen spuriously after seeking; skip this
obscure frame, and hope libmpcdec
recovers */
cmd = client.GetCommand();
continue;
}
mpc_uint32_t ret = frame.samples; mpc_uint32_t ret = frame.samples;
ret *= info.channels; ret *= info.channels;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment