From a2bdf512b31e8f6ecdfdd92176fe8aecd82fe496 Mon Sep 17 00:00:00 2001 From: Joshua Oreman Date: Tue, 19 Dec 2023 21:09:26 -0500 Subject: [PATCH] symbolizer: don't crash if SymbolizedFrame::name is nullptr on entry to Dwarf::findAddress() This can occur when using `Dwarf::findAddress()` directly, rather than through the folly symbolizer. --- folly/experimental/symbolizer/DwarfImpl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/folly/experimental/symbolizer/DwarfImpl.cpp b/folly/experimental/symbolizer/DwarfImpl.cpp index 00aebb5d14d..629dd737972 100644 --- a/folly/experimental/symbolizer/DwarfImpl.cpp +++ b/folly/experimental/symbolizer/DwarfImpl.cpp @@ -238,7 +238,7 @@ bool DwarfImpl::findLocation( // - e.g. coroutines may add .resume/.destroy/.cleanup suffixes // to the symbol name, but not to DW_AT_linkage_name. // - If names share a common prefix, prefer the more specific name. - if (!folly::StringPiece(frame.name).startsWith(name)) { + if (!frame.name || !folly::StringPiece(frame.name).startsWith(name)) { frame.name = name.data(); } }