From cb4fdac469fd1436aac13b890361ba2b69d1e0a6 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 5 Oct 2020 20:18:04 +0200 Subject: [PATCH] playlist/cue/parser: fix nullptr dereference Closes https://github.com/MusicPlayerDaemon/MPD/issues/974 --- NEWS | 2 +- src/playlist/cue/CueParser.cxx | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 4dc6b4e06..ab03945cf 100644 --- a/NEWS +++ b/NEWS @@ -3,7 +3,7 @@ ver 0.22.1 (not yet released) - alsa: don't deadlock when the ALSA driver is buggy - jack, pulse: reduce the delay when stopping or pausing playback * playlist - - cue: fix crash bug + - cue: fix two crash bugs ver 0.22 (2020/09/23) * protocol diff --git a/src/playlist/cue/CueParser.cxx b/src/playlist/cue/CueParser.cxx index e5bd59af4..1bf260f53 100644 --- a/src/playlist/cue/CueParser.cxx +++ b/src/playlist/cue/CueParser.cxx @@ -262,7 +262,9 @@ CueParser::Feed2(char *p) noexcept if (previous != nullptr && previous->GetStartTime().ToMS() < (unsigned)position_ms) previous->SetEndTime(SongTime::FromMS(position_ms)); - current->SetStartTime(SongTime::FromMS(position_ms)); + if (current != nullptr) + current->SetStartTime(SongTime::FromMS(position_ms)); + if(strcmp(nr, "00") != 0 || previous == nullptr) ignore_index = true; }