diff options
author | Max Kellermann <max@musicpd.org> | 2017-03-01 16:12:33 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2017-03-01 16:13:21 +0100 |
commit | 29a7b2c5b58e8da1e78b3744cd3388dc2e4a6f88 (patch) | |
tree | 314643f364eccf50030c101b4413163582d0d85f | |
parent | 3b6c285c2a0de0acf892a1447a6a51e15b26b8f5 (diff) |
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.
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | src/decoder/plugins/MpcdecDecoderPlugin.cxx | 9 |
2 files changed, 11 insertions, 0 deletions
@@ -1,4 +1,6 @@ ver 0.20.6 (not yet released) +* decoder + - mpcdec: fix crash (division by zero) after seeking ver 0.20.5 (2017/02/20) * tags diff --git a/src/decoder/plugins/MpcdecDecoderPlugin.cxx b/src/decoder/plugins/MpcdecDecoderPlugin.cxx index 08a5a3525..0e58c0098 100644 --- a/src/decoder/plugins/MpcdecDecoderPlugin.cxx +++ b/src/decoder/plugins/MpcdecDecoderPlugin.cxx @@ -207,6 +207,15 @@ mpcdec_decode(DecoderClient &client, InputStream &is) if (frame.bits == -1) 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; ret *= info.channels; |