From 997b4a14beafa2b92a75791f27dcb184c2c70706 Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Fri, 25 Apr 2025 12:50:57 -0400 Subject: Fix Itanium RTTI skipping type info with stripped root type info object --- plugins/rtti/itanium.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'plugins/rtti/itanium.cpp') diff --git a/plugins/rtti/itanium.cpp b/plugins/rtti/itanium.cpp index cc632045..f2b773b0 100644 --- a/plugins/rtti/itanium.cpp +++ b/plugins/rtti/itanium.cpp @@ -321,10 +321,18 @@ std::optional ReadTypeInfoVariant(BinaryView *view, uint64_t ob uint64_t typeInfoAddr = reader.ReadPointer(); if (!view->IsValidOffset(typeInfoAddr)) return std::nullopt; - auto vftSym = view->GetSymbolByAddress(typeInfoAddr); - if (vftSym == nullptr) - return std::nullopt; - baseSym = vftSym; + auto typeInfoSym = view->GetSymbolByAddress(typeInfoAddr); + if (typeInfoSym == nullptr) + { + // For stripped binaries there will be no symbol, contruct a type info object and check. + auto rootTypeInfo = GetTypeInfo(view, typeInfoAddr); + if (!rootTypeInfo.has_value()) + return std::nullopt; + if (rootTypeInfo->type_name.find("__cxxabiv1") == std::string::npos) + return std::nullopt; + typeInfoSym = new Symbol(DataSymbol, fmt::format("_typeinfo_for_{}", rootTypeInfo->type_name), typeInfoAddr); + } + baseSym = typeInfoSym; } auto baseSymName = baseSym->GetShortName(); -- cgit v1.3.1