summaryrefslogtreecommitdiff
path: root/view/pe
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/pe
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/pe')
-rw-r--r--view/pe/peview.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/view/pe/peview.cpp b/view/pe/peview.cpp
index 8537a036..ffe9c91a 100644
--- a/view/pe/peview.cpp
+++ b/view/pe/peview.cpp
@@ -1307,7 +1307,8 @@ bool PEView::Init()
}
vector<pair<BNRelocationInfo, string>> relocs;
- BeginBulkModifySymbols();
+
+ BulkSymbolModification bulkSymbolModification(this);
m_symbolQueue = new SymbolQueue();
m_symExternMappingMetadata = new Metadata(KeyValueDataType);
@@ -2582,7 +2583,7 @@ bool PEView::Init()
delete m_symbolQueue;
m_symbolQueue = nullptr;
- EndBulkModifySymbols();
+ bulkSymbolModification.End();
StoreMetadata("SymbolExternalLibraryMapping", m_symExternMappingMetadata, true);