From 383146a5c4992094ce96b257459c2cf6862b2e0b Mon Sep 17 00:00:00 2001 From: EmosewaMC <39972741+EmosewaMC@users.noreply.github.com> Date: Tue, 7 Nov 2023 14:04:02 -0800 Subject: [PATCH] DIagnostics: Strengthened check --- dCommon/Diagnostics.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dCommon/Diagnostics.cpp b/dCommon/Diagnostics.cpp index 264744f9..75291f55 100644 --- a/dCommon/Diagnostics.cpp +++ b/dCommon/Diagnostics.cpp @@ -145,7 +145,8 @@ void CatchUnhandled(int sig) { std::string functionName = strings[i]; std::string::size_type start = functionName.find('('); std::string::size_type end = functionName.find('+'); - if (start != std::string::npos && end != std::string::npos) { + // strengthened check + if (start != std::string::npos && start + 1 < functionName.size() && end != std::string::npos && start < end) { std::string demangled = functionName.substr(start + 1, end - start - 1); demangled = Demangler::Demangle(demangled.c_str());