From c5d727da39a74d655d83cd747049f6ef2a0536d2 Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Sat, 12 Nov 2016 19:36:44 +0100 Subject: [PATCH] CDVD: check return value of ToLong Reported by coverity --- pcsx2/CDVD/CDVD.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pcsx2/CDVD/CDVD.cpp b/pcsx2/CDVD/CDVD.cpp index f52b5303ab..8b0f7ef9e0 100644 --- a/pcsx2/CDVD/CDVD.cpp +++ b/pcsx2/CDVD/CDVD.cpp @@ -429,7 +429,11 @@ void cdvdReloadElfInfo(wxString elfoverride) static __fi s32 StrToS32(const wxString& str, int base = 10) { long l; - str.ToLong(&l, base); + if (!str.ToLong(&l, base)) { + Console.Error(L"StrToS32: fail to translate '%s' as long", WX_STR(str)); + return 0; + } + return l; }