diff options
| author | Mark Rowe <mark@vector35.com> | 2025-11-28 11:13:08 -0800 |
|---|---|---|
| committer | Mark Rowe <mark@vector35.com> | 2025-12-08 13:21:58 -0800 |
| commit | 540fca65afaff35343a938b86596b21f2e16b48d (patch) | |
| tree | f84da14232124ab1829f4051de2794b304355827 /view/macho | |
| parent | daede114cfacf4cd68ed0a9f67c829b8b16da961 (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/macho')
| -rw-r--r-- | view/macho/machoview.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/view/macho/machoview.cpp b/view/macho/machoview.cpp index 7353e995..1c8d8512 100644 --- a/view/macho/machoview.cpp +++ b/view/macho/machoview.cpp @@ -2088,7 +2088,7 @@ bool MachoView::InitializeHeader(MachOHeader& header, bool isMainHeader, uint64_ ParseFunctionStarts(GetDefaultPlatform(), header.textBase, header.functionStarts); } - BeginBulkModifySymbols(); + BulkSymbolModification bulkSymbolModification(this); m_symbolQueue = new SymbolQueue(); try @@ -2105,8 +2105,7 @@ bool MachoView::InitializeHeader(MachOHeader& header, bool isMainHeader, uint64_ m_symbolQueue->Process(); delete m_symbolQueue; m_symbolQueue = nullptr; - - EndBulkModifySymbols(); + bulkSymbolModification.End(); for (auto& relocation : header.rebaseRelocations) { |
