Skip to content

Commit b82c577

Browse files
committed
Add setter for BB analysis context max_size_reached
Add setter for Python and rust BasicBlockAnalysisContext.max_size_reached
1 parent 314d2ca commit b82c577

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

python/architecture.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ class BasicBlockAnalysisContext:
8686
_translate_tail_calls: bool
8787
_disallow_branch_to_string: bool
8888
_max_function_size: int
89-
_max_size_reached: bool
9089

9190
# In/Out
91+
_max_size_reached: bool
9292
_contextual_returns: Dict["function.ArchAndAddr", bool]
9393

9494
# Out
@@ -231,6 +231,17 @@ def max_size_reached(self) -> bool:
231231

232232
return self._max_size_reached
233233

234+
@max_size_reached.setter
235+
def max_size_reached(self, value: bool) -> None:
236+
"""Set boolean that indicates if the maximum function size has been reached.
237+
238+
:param bool value: The new value for max_size_reached
239+
"""
240+
if not isinstance(value, bool):
241+
raise TypeError("value must be a boolean")
242+
243+
self._max_size_reached = value
244+
234245
@property
235246
def contextual_returns(self) -> Dict["function.ArchAndAddr", bool]:
236247
"""Get the mapping of contextual function return locations to their values."""
@@ -387,6 +398,7 @@ def finalize(self) -> None:
387398
halted_addresses[i].address = loc.addr
388399
core.BNAnalyzeBasicBlocksContextSetHaltedDisassemblyAddresses(self._handle, halted_addresses, total)
389400

401+
self._handle.maxSizeReached = ctypes.c_bool(self._max_size_reached)
390402
if self._contextual_returns_dirty:
391403
total = len(self._contextual_returns)
392404
values = (ctypes.c_bool * total)()

rust/src/architecture.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1966,9 +1966,9 @@ pub struct BasicBlockAnalysisContext {
19661966
pub translate_tail_calls: bool,
19671967
pub disallow_branch_to_string: bool,
19681968
pub max_function_size: u64,
1969-
pub max_size_reached: bool,
19701969

19711970
// In/Out
1971+
pub max_size_reached: bool,
19721972
contextual_returns: HashMap<ArchAndAddr, bool>,
19731973

19741974
// Out
@@ -2179,6 +2179,10 @@ impl BasicBlockAnalysisContext {
21792179
}
21802180
}
21812181

2182+
unsafe {
2183+
(*self.handle).maxSizeReached = self.max_size_reached;
2184+
}
2185+
21822186
if self.contextual_returns_dirty {
21832187
let total = self.contextual_returns.len();
21842188
let mut locations: Vec<BNArchitectureAndAddress> = Vec::with_capacity(total);

0 commit comments

Comments
 (0)