From cab368b4ac762d3577c111556be8468eb1579f8f Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sun, 3 Sep 2023 15:40:48 +0200 Subject: [PATCH] infer_current_exe: Avoid picking non-path from maps Some ports are not showing paths in /proc/self/maps yet, so better make sure that we actually get a path before returning it, and fallback to current_exe() otherwise. --- src/symbolize/gimli/libs_dl_iterate_phdr.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/symbolize/gimli/libs_dl_iterate_phdr.rs b/src/symbolize/gimli/libs_dl_iterate_phdr.rs index 9f0304ce8..644520d42 100644 --- a/src/symbolize/gimli/libs_dl_iterate_phdr.rs +++ b/src/symbolize/gimli/libs_dl_iterate_phdr.rs @@ -25,7 +25,9 @@ fn infer_current_exe(base_addr: usize) -> OsString { .map(|e| e.pathname()) .cloned(); if let Some(path) = opt_path { - return path; + if path.as_bytes()[0] as char == '/' { + return path; + } } } env::current_exe().map(|e| e.into()).unwrap_or_default()