summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Ferrell <josh@vector35.com>2025-04-18 14:46:09 -0400
committerPeter LaFosse <peter@vector35.com>2025-04-21 09:24:37 -0400
commitaf44dc013e54bd485edc3b354a7aff3d83dccaa4 (patch)
tree665cfa943cbb0a44af91aa45735391207f446ce6
parent2b31504fcdedd68a94fbd6ad90d7d2967b46291a (diff)
Actually fix crash when opening aarch64 TE binary with free version
-rw-r--r--view/pe/teview.cpp10
-rw-r--r--view/pe/teview.h3
2 files changed, 11 insertions, 2 deletions
diff --git a/view/pe/teview.cpp b/view/pe/teview.cpp
index d7ac7a9c..4c27c21a 100644
--- a/view/pe/teview.cpp
+++ b/view/pe/teview.cpp
@@ -242,21 +242,27 @@ bool TEView::Init()
{
case IMAGE_FILE_MACHINE_I386:
platform = Platform::GetByName("efi-x86");
+ m_addressSize = 4;
break;
case IMAGE_FILE_MACHINE_AMD64:
platform = Platform::GetByName("efi-x86_64");
+ m_addressSize = 8;
break;
case IMAGE_FILE_MACHINE_ARM64:
platform = Platform::GetByName("efi-aarch64");
+ m_addressSize = 8;
break;
case IMAGE_FILE_MACHINE_ARM:
platform = Platform::GetByName("efi-armv7");
+ m_addressSize = 4;
break;
case IMAGE_FILE_MACHINE_THUMB:
platform = Platform::GetByName("efi-thumb2");
+ m_addressSize = 4;
break;
default:
LogError("TE platform '0x%x' is not supported", header.machine);
+ m_addressSize = 4;
if (!m_parseOnly)
m_logger->LogWarn("Unable to determine architecture. Please open the file with options and select a valid architecture.");
return false;
@@ -276,6 +282,8 @@ bool TEView::Init()
return false;
}
+ m_addressSize = m_arch->GetAddressSize();
+
SetDefaultPlatform(platform);
SetDefaultArchitecture(m_arch);
@@ -309,7 +317,7 @@ uint64_t TEView::PerformGetEntryPoint() const
size_t TEView::PerformGetAddressSize() const
{
- return m_arch->GetAddressSize();
+ return m_addressSize;
}
TEViewType::TEViewType() : BinaryViewType("TE", "TE")
diff --git a/view/pe/teview.h b/view/pe/teview.h
index 22177751..ab4c2183 100644
--- a/view/pe/teview.h
+++ b/view/pe/teview.h
@@ -62,7 +62,8 @@ namespace BinaryNinja
uint64_t m_headersOffset;
Ref<Architecture> m_arch;
uint64_t m_entryPoint;
-
+ uint32_t m_addressSize = 4;
+
protected:
virtual uint64_t PerformGetEntryPoint() const override;
virtual bool PerformIsExecutable() const override { return true; }