From fac171fa95dd981ef3d419ddc6560bb5c2872751 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Sat, 18 Dec 2021 17:50:51 +1000 Subject: [PATCH] CDVD: Check file actually opened before proceeding If you loaded an invalid file, particularly with compression, the file open may fail, leading to a division by zero (on block size), or trying to read from nothing. --- pcsx2/CDVD/InputIsoFile.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pcsx2/CDVD/InputIsoFile.cpp b/pcsx2/CDVD/InputIsoFile.cpp index e8bb885c9c..f43bb251d4 100644 --- a/pcsx2/CDVD/InputIsoFile.cpp +++ b/pcsx2/CDVD/InputIsoFile.cpp @@ -221,7 +221,8 @@ bool InputIsoFile::Open(std::string srcfile, bool testOnly) m_reader = new FlatFileReader(EmuConfig.CdvdShareWrite); } - m_reader->Open(m_filename); + if (!m_reader->Open(m_filename)) + return false; // It might actually be a blockdump file. // Check that before continuing with the FlatFileReader.