summaryrefslogtreecommitdiff
path: root/view/elf
diff options
context:
space:
mode:
authorMark Rowe <mark@vector35.com>2025-11-28 11:13:08 -0800
committerMark Rowe <mark@vector35.com>2025-12-08 13:21:58 -0800
commit540fca65afaff35343a938b86596b21f2e16b48d (patch)
treef84da14232124ab1829f4051de2794b304355827 /view/elf
parentdaede114cfacf4cd68ed0a9f67c829b8b16da961 (diff)
Introduce an RAII type for managing bulk symbol modifications
Fixes https://github.com/Vector35/binaryninja-api/issues/7666. Correctly managing the state of bulk symbol modifications via `BeginBulkModifySymbols` / `EndBulkModifySymbols` is error-prone in the face of exceptions and early returns. Leaking a bulk symbol modification can leave the view in a state where no further changes to symbols will be applied. All users of the C++ API are encouraged to move from `BeginBulkModifySymbols` / `EndBulkModifySymbols` to the new `BulkSymbolModification` class.
Diffstat (limited to 'view/elf')
-rw-r--r--view/elf/elfview.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/view/elf/elfview.cpp b/view/elf/elfview.cpp
index 0e206032..e473795f 100644
--- a/view/elf/elfview.cpp
+++ b/view/elf/elfview.cpp
@@ -1053,7 +1053,7 @@ bool ElfView::Init()
m_logger->LogError("ELF relocation table invalid");
}
- BeginBulkModifySymbols();
+ BulkSymbolModification bulkSymbolModification(this);
vector<ElfSymbolTableEntry> auxSymbolTable;
try
@@ -1408,7 +1408,7 @@ bool ElfView::Init()
delete m_symbolQueue;
m_symbolQueue = nullptr;
- EndBulkModifySymbols();
+ bulkSymbolModification.End();
auto relocHandler = m_arch->GetRelocationHandler("ELF");
if (relocHandler)