From c41f264a1dba68c89b4a224a70e3a5783f7fa879 Mon Sep 17 00:00:00 2001 From: Rusty Wagner Date: Tue, 24 Jun 2025 17:55:48 -0400 Subject: Remove implicit conversions from Confidence to underlying type, these can cause bugs and also issues with C++20 --- view/elf/elfview.cpp | 9 +++++---- view/elf/elfview.h | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'view/elf') diff --git a/view/elf/elfview.cpp b/view/elf/elfview.cpp index d8a0a112..b8dd1aaa 100644 --- a/view/elf/elfview.cpp +++ b/view/elf/elfview.cpp @@ -2396,7 +2396,8 @@ bool ElfView::Init() ); /* create type, associate it with RTL_Resolve */ - Ref ptr_type = Type::PointerType(m_arch, Type::VoidType())->WithConfidence(BN_FULL_CONFIDENCE); + Confidence> ptr_type = + Type::PointerType(m_arch, Type::VoidType())->WithConfidence(BN_FULL_CONFIDENCE); Ref cc = m_arch->GetCallingConventionByName("linux-rtlresolve"); @@ -2452,20 +2453,20 @@ bool ElfView::Init() void ElfView::DefineElfSymbol(BNSymbolType type, const string& incomingName, uint64_t addr, bool gotEntry, - BNSymbolBinding binding, size_t size, Ref typeObj) + BNSymbolBinding binding, size_t size, const Confidence>& typeObj) { // Ensure symbol is within the executable if (type != ExternalSymbol && !IsValidOffset(addr)) return; string name = incomingName; - Ref symbolTypeRef; + Confidence> symbolTypeRef; if ((type == ExternalSymbol) || (type == ImportAddressSymbol) || (type == ImportedDataSymbol)) { QualifiedName n(name); Ref lib = nullptr; symbolTypeRef = ImportTypeLibraryObject(lib, n); - if (symbolTypeRef) + if (symbolTypeRef.GetValue()) { m_logger->LogDebug("elf: type Library '%s' found hit for '%s'", lib->GetName().c_str(), name.c_str()); if (type != ExternalSymbol || addr != 0) diff --git a/view/elf/elfview.h b/view/elf/elfview.h index 23a5021a..a43716b7 100644 --- a/view/elf/elfview.h +++ b/view/elf/elfview.h @@ -518,7 +518,7 @@ namespace BinaryNinja SymbolQueue* m_symbolQueue = nullptr; void DefineElfSymbol(BNSymbolType type, const std::string& name, uint64_t addr, bool gotEntry, - BNSymbolBinding binding, size_t size=0, Ref typeObj=nullptr); + BNSymbolBinding binding, size_t size = 0, const Confidence>& typeObj = nullptr); void ApplyTypesToParentStringTable(const Elf64SectionHeader& section, const bool offset = true); void ApplyTypesToStringTable(const Elf64SectionHeader& section, const int64_t imageBaseAdjustment, const bool offset = true); -- cgit v1.3.1