diff options
| author | Xusheng <xusheng@vector35.com> | 2024-06-18 15:27:14 +0800 |
|---|---|---|
| committer | Xusheng <xusheng@vector35.com> | 2024-06-18 15:27:14 +0800 |
| commit | 6d2f24c84947f188f4056d39b2cb22ee1d870022 (patch) | |
| tree | 2c1ac5a67f92ead0863f4396ba30630eae7d5ecc /view | |
| parent | 7fe90070052c19d174585e7152ba66f3057328e7 (diff) | |
More conservative detection of ARM BE8 binaries. Fix https://github.com/Vector35/binaryninja-api/issues/5621
Diffstat (limited to 'view')
| -rw-r--r-- | view/elf/elfview.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/view/elf/elfview.cpp b/view/elf/elfview.cpp index defd6600..cf9f4efa 100644 --- a/view/elf/elfview.cpp +++ b/view/elf/elfview.cpp @@ -31,6 +31,15 @@ void BinaryNinja::InitElfViewType() "description" : "Maximum number of entries to include in section header array", "ignore" : ["SettingsProjectScope"] })"); + + settings->RegisterSetting("files.elf.detectARMBE8Binary", + R"({ + "title" : "Enable ARM BE8 binary detection", + "type" : "boolean", + "default" : true, + "description" : "Enable ARM BE8 binary detection for mixed little/big endianness for code/data", + "ignore" : ["SettingsProjectScope"] + })"); } @@ -2740,7 +2749,8 @@ uint64_t ElfViewType::ParseHeaders(BinaryView* data, ElfIdent& ident, ElfCommonH // retrieve architecture // FIXME: Architecture registration methods should perhaps be virtual and take the raw data, or some additional opaque information. - endianness = header.flags & EF_ARM_BE8 ? BigEndian : endianness; + if (Settings::Instance()->Get<bool>("files.elf.detectARMBE8Binary")) + endianness = ((commonHeader.arch == EM_ARM) && (header.flags & EF_ARM_BE8)) ? BigEndian : endianness; /* for architectures where .e_machine field doesn't disambiguate between 32/64 (like MIPS), form the conventional alternative id, including the .e_ident[EI_CLASS] field */ |
