summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2021-03-05 11:32:37 -0500
committer AJR <ajrhacker@users.noreply.github.com>2021-03-05 11:32:37 -0500
commitad3fa37944c02ef6f39663c039d88e7bb90cf8ee (patch)
tree7e54feddadb23b6d1b4a14f21a618c2bb4ccc7e5
parent05da482144d31e3aaa8d2f9fc51fce5ed423f446 (diff)
corefile.cpp: Make core_filename_extract_base behave more robustly in degenerate cases
-rw-r--r--src/lib/util/corefile.cpp2
1 files changed, 2 insertions, 0 deletions
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