From 9851b753680a46d28307e044ad55a2fc535382a4 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Wed, 8 Apr 2020 11:58:05 +1000 Subject: [PATCH] CDImage: Fix crash on invalid cuesheet --- src/common/cd_image_cue.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/common/cd_image_cue.cpp b/src/common/cd_image_cue.cpp index e54256331..1b1df48ef 100644 --- a/src/common/cd_image_cue.cpp +++ b/src/common/cd_image_cue.cpp @@ -71,6 +71,12 @@ bool CDImageCueSheet::OpenAndParse(const char* filename) for (int track_num = 1; track_num <= num_tracks; track_num++) { const ::Track* track = cd_get_track(m_cd, track_num); + if (!track || !track_get_filename(track)) + { + Log_ErrorPrint("Track/filename missing for track %d", track_num); + return false; + } + const std::string track_filename = track_get_filename(track); long track_start = track_get_start(track); long track_length = track_get_length(track);