From ad3fa37944c02ef6f39663c039d88e7bb90cf8ee Mon Sep 17 00:00:00 2001 From: AJR Date: Fri, 5 Mar 2021 11:32:37 -0500 Subject: corefile.cpp: Make core_filename_extract_base behave more robustly in degenerate cases --- src/lib/util/corefile.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib/util/corefile.cpp b/src/lib/util/corefile.cpp index 8cb8deea8f2..e681c0f1fac 100644 --- a/src/lib/util/corefile.cpp +++ b/src/lib/util/corefile.cpp @@ -1260,6 +1260,8 @@ std::string_view core_filename_extract_base(std::string_view name, bool strip_ex { // find the start of the basename auto const start = std::find_if(name.rbegin(), name.rend(), &util::is_directory_separator); + if (start == name.rbegin()) + return std::string_view(); // find the end of the basename auto const chop_position = strip_extension -- cgit v1.2.3