summaryrefslogtreecommitdiff
path: root/view/kernelcache
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/kernelcache
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/kernelcache')
-rw-r--r--view/kernelcache/core/MachOProcessor.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/view/kernelcache/core/MachOProcessor.cpp b/view/kernelcache/core/MachOProcessor.cpp
index fb3d2b27..5731d80e 100644
--- a/view/kernelcache/core/MachOProcessor.cpp
+++ b/view/kernelcache/core/MachOProcessor.cpp
@@ -50,7 +50,7 @@ void KernelCacheMachOProcessor::ApplyHeader(const KernelCache& cache, KernelCach
m_view->AddFunctionForAnalysis(targetPlatform, func, false);
}
- m_view->BeginBulkModifySymbols();
+ BulkSymbolModification bulkSymbolModification(m_view);
// Apply symbols from symbol table.
if (header.symtab.symoff != 0)
@@ -78,7 +78,6 @@ void KernelCacheMachOProcessor::ApplyHeader(const KernelCache& cache, KernelCach
ApplySymbol(m_view, typeLib, symbol, symbolType);
}
}
- m_view->EndBulkModifySymbols();
}
uint64_t KernelCacheMachOProcessor::ApplyHeaderSections(KernelCacheMachOHeader& header)