diff options
| author | Mason Reed <mason@vector35.com> | 2025-04-25 12:50:57 -0400 |
|---|---|---|
| committer | Mason Reed <mason@vector35.com> | 2025-04-25 12:50:57 -0400 |
| commit | 997b4a14beafa2b92a75791f27dcb184c2c70706 (patch) | |
| tree | 6f1463b9d683347e4f92d6eff65358fc79053747 /plugins/rtti/itanium.cpp | |
| parent | 71af6853ae407d70dc0783d5682b80563d045a90 (diff) | |
Fix Itanium RTTI skipping type info with stripped root type info object
Diffstat (limited to 'plugins/rtti/itanium.cpp')
| -rw-r--r-- | plugins/rtti/itanium.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
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<TypeInfoVariant> 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(); |
