angr 9.2.102__py3-none-win_amd64.whl → 9.2.103__py3-none-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of angr might be problematic. Click here for more details.
- angr/__init__.py +1 -1
- angr/analyses/analysis.py +7 -6
- angr/analyses/calling_convention.py +33 -35
- angr/analyses/cdg.py +2 -4
- angr/analyses/cfg/cfb.py +4 -3
- angr/analyses/cfg/cfg_base.py +14 -14
- angr/analyses/cfg/cfg_emulated.py +3 -4
- angr/analyses/cfg/cfg_fast.py +46 -46
- angr/analyses/cfg/cfg_fast_soot.py +1 -2
- angr/analyses/cfg/cfg_job_base.py +2 -2
- angr/analyses/cfg/indirect_jump_resolvers/jumptable.py +14 -13
- angr/analyses/cfg/indirect_jump_resolvers/mips_elf_fast.py +5 -5
- angr/analyses/cfg_slice_to_sink/cfg_slice_to_sink.py +3 -3
- angr/analyses/complete_calling_conventions.py +13 -12
- angr/analyses/data_dep/data_dependency_analysis.py +24 -24
- angr/analyses/data_dep/dep_nodes.py +3 -3
- angr/analyses/ddg.py +1 -2
- angr/analyses/decompiler/ail_simplifier.py +35 -34
- angr/analyses/decompiler/block_io_finder.py +20 -20
- angr/analyses/decompiler/block_similarity.py +4 -6
- angr/analyses/decompiler/block_simplifier.py +17 -16
- angr/analyses/decompiler/callsite_maker.py +25 -10
- angr/analyses/decompiler/ccall_rewriters/amd64_ccalls.py +1 -3
- angr/analyses/decompiler/ccall_rewriters/rewriter_base.py +2 -4
- angr/analyses/decompiler/clinic.py +250 -45
- angr/analyses/decompiler/condition_processor.py +15 -8
- angr/analyses/decompiler/decompilation_cache.py +7 -7
- angr/analyses/decompiler/decompilation_options.py +4 -4
- angr/analyses/decompiler/decompiler.py +19 -15
- angr/analyses/decompiler/expression_counters.py +10 -9
- angr/analyses/decompiler/goto_manager.py +2 -4
- angr/analyses/decompiler/graph_region.py +9 -9
- angr/analyses/decompiler/jump_target_collector.py +1 -2
- angr/analyses/decompiler/optimization_passes/__init__.py +4 -3
- angr/analyses/decompiler/optimization_passes/code_motion.py +5 -6
- angr/analyses/decompiler/optimization_passes/const_derefs.py +4 -4
- angr/analyses/decompiler/optimization_passes/deadblock_remover.py +73 -0
- angr/analyses/decompiler/optimization_passes/engine_base.py +25 -3
- angr/analyses/decompiler/optimization_passes/expr_op_swapper.py +6 -5
- angr/analyses/decompiler/optimization_passes/flip_boolean_cmp.py +2 -2
- angr/analyses/decompiler/optimization_passes/inlined_string_transformation_simplifier.py +3 -0
- angr/analyses/decompiler/optimization_passes/ite_expr_converter.py +2 -2
- angr/analyses/decompiler/optimization_passes/lowered_switch_simplifier.py +17 -17
- angr/analyses/decompiler/optimization_passes/optimization_pass.py +12 -13
- angr/analyses/decompiler/optimization_passes/register_save_area_simplifier.py +25 -21
- angr/analyses/decompiler/optimization_passes/ret_addr_save_simplifier.py +3 -3
- angr/analyses/decompiler/optimization_passes/ret_deduplicator.py +1 -2
- angr/analyses/decompiler/optimization_passes/return_duplicator_base.py +7 -7
- angr/analyses/decompiler/optimization_passes/spilled_register_finder.py +18 -0
- angr/analyses/decompiler/optimization_passes/stack_canary_simplifier.py +2 -3
- angr/analyses/decompiler/optimization_passes/win_stack_canary_simplifier.py +1 -2
- angr/analyses/decompiler/optimization_passes/x86_gcc_getpc_simplifier.py +2 -2
- angr/analyses/decompiler/peephole_optimizations/__init__.py +4 -3
- angr/analyses/decompiler/peephole_optimizations/base.py +13 -15
- angr/analyses/decompiler/peephole_optimizations/bswap.py +1 -3
- angr/analyses/decompiler/peephole_optimizations/cmpord_rewriter.py +72 -0
- angr/analyses/decompiler/peephole_optimizations/const_mull_a_shift.py +1 -2
- angr/analyses/decompiler/peephole_optimizations/eager_eval.py +1 -1
- angr/analyses/decompiler/peephole_optimizations/inlined_strcpy.py +5 -10
- angr/analyses/decompiler/peephole_optimizations/inlined_strcpy_consolidation.py +3 -4
- angr/analyses/decompiler/peephole_optimizations/inlined_wstrcpy.py +7 -10
- angr/analyses/decompiler/peephole_optimizations/rewrite_bit_extractions.py +2 -3
- angr/analyses/decompiler/peephole_optimizations/sar_to_signed_div.py +1 -2
- angr/analyses/decompiler/peephole_optimizations/tidy_stack_addr.py +4 -4
- angr/analyses/decompiler/redundant_label_remover.py +4 -5
- angr/analyses/decompiler/region_identifier.py +4 -5
- angr/analyses/decompiler/region_simplifiers/cascading_cond_transformer.py +1 -2
- angr/analyses/decompiler/region_simplifiers/expr_folding.py +19 -20
- angr/analyses/decompiler/region_simplifiers/goto.py +2 -3
- angr/analyses/decompiler/region_simplifiers/loop.py +1 -2
- angr/analyses/decompiler/region_simplifiers/node_address_finder.py +1 -2
- angr/analyses/decompiler/region_simplifiers/region_simplifier.py +1 -3
- angr/analyses/decompiler/region_simplifiers/switch_cluster_simplifier.py +19 -19
- angr/analyses/decompiler/return_maker.py +1 -2
- angr/analyses/decompiler/structured_codegen/base.py +5 -6
- angr/analyses/decompiler/structured_codegen/c.py +39 -38
- angr/analyses/decompiler/structuring/__init__.py +1 -1
- angr/analyses/decompiler/structuring/dream.py +17 -16
- angr/analyses/decompiler/structuring/phoenix.py +45 -46
- angr/analyses/decompiler/structuring/recursive_structurer.py +4 -4
- angr/analyses/decompiler/structuring/structurer_base.py +16 -15
- angr/analyses/decompiler/structuring/structurer_nodes.py +10 -9
- angr/analyses/decompiler/utils.py +17 -16
- angr/analyses/disassembly.py +7 -6
- angr/analyses/flirt.py +9 -9
- angr/analyses/forward_analysis/forward_analysis.py +15 -14
- angr/analyses/forward_analysis/visitors/function_graph.py +1 -2
- angr/analyses/forward_analysis/visitors/graph.py +16 -15
- angr/analyses/propagator/engine_ail.py +30 -26
- angr/analyses/propagator/outdated_definition_walker.py +8 -7
- angr/analyses/propagator/propagator.py +11 -13
- angr/analyses/proximity_graph.py +21 -21
- angr/analyses/reaching_definitions/__init__.py +3 -3
- angr/analyses/reaching_definitions/call_trace.py +3 -6
- angr/analyses/reaching_definitions/dep_graph.py +41 -48
- angr/analyses/reaching_definitions/engine_ail.py +11 -5
- angr/analyses/reaching_definitions/engine_vex.py +9 -8
- angr/analyses/reaching_definitions/function_handler.py +51 -34
- angr/analyses/reaching_definitions/heap_allocator.py +3 -4
- angr/analyses/reaching_definitions/rd_initializer.py +8 -8
- angr/analyses/reaching_definitions/rd_state.py +57 -58
- angr/analyses/reaching_definitions/reaching_definitions.py +18 -17
- angr/analyses/reaching_definitions/subject.py +2 -3
- angr/analyses/stack_pointer_tracker.py +15 -6
- angr/analyses/typehoon/dfa.py +4 -4
- angr/analyses/typehoon/simple_solver.py +48 -52
- angr/analyses/typehoon/translator.py +3 -6
- angr/analyses/typehoon/typeconsts.py +13 -14
- angr/analyses/typehoon/typehoon.py +9 -9
- angr/analyses/typehoon/typevars.py +18 -17
- angr/analyses/variable_recovery/engine_ail.py +5 -5
- angr/analyses/variable_recovery/engine_base.py +25 -21
- angr/analyses/variable_recovery/irsb_scanner.py +8 -9
- angr/analyses/variable_recovery/variable_recovery.py +1 -2
- angr/analyses/variable_recovery/variable_recovery_base.py +14 -13
- angr/analyses/variable_recovery/variable_recovery_fast.py +8 -8
- angr/analyses/veritesting.py +1 -2
- angr/analyses/vfg.py +57 -56
- angr/analyses/xrefs.py +1 -2
- angr/angrdb/db.py +7 -7
- angr/angrdb/serializers/kb.py +16 -13
- angr/angrdb/serializers/loader.py +1 -2
- angr/angrdb/serializers/structured_code.py +2 -2
- angr/annocfg.py +1 -2
- angr/block.py +16 -6
- angr/calling_conventions.py +27 -27
- angr/code_location.py +8 -8
- angr/codenode.py +1 -2
- angr/concretization_strategies/max.py +1 -3
- angr/distributed/server.py +1 -3
- angr/distributed/worker.py +1 -2
- angr/engines/engine.py +2 -3
- angr/engines/light/engine.py +4 -4
- angr/engines/pcode/behavior.py +20 -2
- angr/engines/pcode/emulate.py +1 -1
- angr/engines/pcode/engine.py +7 -7
- angr/engines/pcode/lifter.py +78 -77
- angr/engines/vex/claripy/ccall.py +1 -2
- angr/engines/vex/claripy/datalayer.py +1 -2
- angr/engines/vex/light/light.py +1 -2
- angr/exploration_techniques/tracer.py +4 -4
- angr/factory.py +12 -15
- angr/flirt/__init__.py +8 -8
- angr/flirt/build_sig.py +2 -3
- angr/keyed_region.py +2 -2
- angr/knowledge_base/knowledge_base.py +3 -3
- angr/knowledge_plugins/callsite_prototypes.py +4 -6
- angr/knowledge_plugins/cfg/cfg_manager.py +19 -6
- angr/knowledge_plugins/cfg/cfg_model.py +26 -27
- angr/knowledge_plugins/cfg/cfg_node.py +2 -2
- angr/knowledge_plugins/cfg/indirect_jump.py +6 -8
- angr/knowledge_plugins/cfg/memory_data.py +8 -9
- angr/knowledge_plugins/custom_strings.py +1 -3
- angr/knowledge_plugins/debug_variables.py +2 -2
- angr/knowledge_plugins/functions/function.py +21 -22
- angr/knowledge_plugins/functions/function_manager.py +5 -5
- angr/knowledge_plugins/indirect_jumps.py +1 -3
- angr/knowledge_plugins/key_definitions/atoms.py +7 -7
- angr/knowledge_plugins/key_definitions/definition.py +14 -14
- angr/knowledge_plugins/key_definitions/environment.py +5 -7
- angr/knowledge_plugins/key_definitions/heap_address.py +1 -3
- angr/knowledge_plugins/key_definitions/key_definition_manager.py +3 -2
- angr/knowledge_plugins/key_definitions/live_definitions.py +60 -59
- angr/knowledge_plugins/key_definitions/liveness.py +16 -16
- angr/knowledge_plugins/key_definitions/rd_model.py +15 -15
- angr/knowledge_plugins/key_definitions/uses.py +11 -11
- angr/knowledge_plugins/patches.py +4 -8
- angr/knowledge_plugins/propagations/prop_value.py +10 -9
- angr/knowledge_plugins/propagations/propagation_manager.py +3 -5
- angr/knowledge_plugins/propagations/propagation_model.py +9 -9
- angr/knowledge_plugins/propagations/states.py +52 -22
- angr/knowledge_plugins/structured_code/manager.py +2 -2
- angr/knowledge_plugins/sync/sync_controller.py +3 -3
- angr/knowledge_plugins/variables/variable_access.py +4 -4
- angr/knowledge_plugins/variables/variable_manager.py +39 -39
- angr/knowledge_plugins/xrefs/xref.py +9 -11
- angr/knowledge_plugins/xrefs/xref_manager.py +3 -4
- angr/lib/angr_native.dll +0 -0
- angr/misc/ansi.py +1 -2
- angr/misc/autoimport.py +3 -3
- angr/misc/plugins.py +9 -9
- angr/procedures/definitions/__init__.py +16 -16
- angr/procedures/definitions/linux_kernel.py +1 -1
- angr/procedures/definitions/parse_win32json.py +1 -1
- angr/procedures/java_jni/__init__.py +1 -1
- angr/procedures/java_jni/array_operations.py +1 -2
- angr/procedures/java_jni/method_calls.py +1 -2
- angr/procedures/posix/inet_ntoa.py +1 -2
- angr/procedures/stubs/format_parser.py +3 -3
- angr/project.py +13 -11
- angr/sim_manager.py +12 -12
- angr/sim_procedure.py +7 -3
- angr/sim_state.py +2 -2
- angr/sim_type.py +60 -45
- angr/sim_variable.py +5 -5
- angr/simos/simos.py +1 -2
- angr/simos/userland.py +1 -2
- angr/state_plugins/callstack.py +3 -2
- angr/state_plugins/history.py +1 -2
- angr/state_plugins/solver.py +34 -34
- angr/storage/memory_mixins/__init__.py +4 -3
- angr/storage/memory_mixins/actions_mixin.py +1 -3
- angr/storage/memory_mixins/address_concretization_mixin.py +1 -3
- angr/storage/memory_mixins/convenient_mappings_mixin.py +3 -4
- angr/storage/memory_mixins/default_filler_mixin.py +1 -1
- angr/storage/memory_mixins/label_merger_mixin.py +2 -2
- angr/storage/memory_mixins/multi_value_merger_mixin.py +4 -3
- angr/storage/memory_mixins/paged_memory/page_backer_mixins.py +9 -8
- angr/storage/memory_mixins/paged_memory/paged_memory_mixin.py +12 -11
- angr/storage/memory_mixins/paged_memory/pages/cooperation.py +8 -8
- angr/storage/memory_mixins/paged_memory/pages/history_tracking_mixin.py +2 -3
- angr/storage/memory_mixins/paged_memory/pages/list_page.py +10 -11
- angr/storage/memory_mixins/paged_memory/pages/multi_values.py +11 -10
- angr/storage/memory_mixins/paged_memory/pages/mv_list_page.py +18 -17
- angr/storage/memory_mixins/paged_memory/pages/ultra_page.py +12 -11
- angr/storage/memory_mixins/regioned_memory/abstract_address_descriptor.py +3 -3
- angr/storage/memory_mixins/regioned_memory/abstract_merger_mixin.py +3 -2
- angr/storage/memory_mixins/regioned_memory/region_data.py +1 -2
- angr/storage/memory_mixins/regioned_memory/region_meta_mixin.py +2 -2
- angr/storage/memory_mixins/regioned_memory/regioned_address_concretization_mixin.py +3 -3
- angr/storage/memory_mixins/regioned_memory/regioned_memory_mixin.py +18 -21
- angr/storage/memory_mixins/size_resolution_mixin.py +1 -2
- angr/storage/memory_mixins/symbolic_merger_mixin.py +3 -2
- angr/storage/memory_mixins/top_merger_mixin.py +3 -2
- angr/storage/memory_object.py +2 -4
- angr/utils/algo.py +3 -2
- angr/utils/dynamic_dictlist.py +5 -5
- angr/utils/formatting.py +4 -4
- angr/utils/funcid.py +1 -2
- angr/utils/graph.py +5 -6
- angr/utils/library.py +5 -5
- angr/utils/mp.py +5 -4
- angr/utils/segment_list.py +3 -4
- angr/utils/typing.py +3 -2
- {angr-9.2.102.dist-info → angr-9.2.103.dist-info}/METADATA +9 -11
- {angr-9.2.102.dist-info → angr-9.2.103.dist-info}/RECORD +240 -237
- {angr-9.2.102.dist-info → angr-9.2.103.dist-info}/LICENSE +0 -0
- {angr-9.2.102.dist-info → angr-9.2.103.dist-info}/WHEEL +0 -0
- {angr-9.2.102.dist-info → angr-9.2.103.dist-info}/entry_points.txt +0 -0
- {angr-9.2.102.dist-info → angr-9.2.103.dist-info}/top_level.txt +0 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
# pylint:disable=no-member
|
|
2
2
|
import pickle
|
|
3
3
|
import logging
|
|
4
|
-
from typing import Optional,
|
|
4
|
+
from typing import Optional, DefaultDict, TYPE_CHECKING
|
|
5
|
+
from collections.abc import Callable
|
|
5
6
|
from collections import defaultdict
|
|
6
7
|
import bisect
|
|
7
8
|
import string
|
|
@@ -65,20 +66,20 @@ class CFGModel(Serializable):
|
|
|
65
66
|
self.graph = networkx.DiGraph()
|
|
66
67
|
|
|
67
68
|
# Jump tables
|
|
68
|
-
self.jump_tables:
|
|
69
|
+
self.jump_tables: dict[int, IndirectJump] = {}
|
|
69
70
|
|
|
70
71
|
# Memory references
|
|
71
72
|
# A mapping between address and the actual data in memory
|
|
72
|
-
self.memory_data:
|
|
73
|
+
self.memory_data: dict[int, MemoryData] = {}
|
|
73
74
|
# A mapping between address of the instruction that's referencing the memory data and the memory data itself
|
|
74
|
-
self.insn_addr_to_memory_data:
|
|
75
|
+
self.insn_addr_to_memory_data: dict[int, MemoryData] = {}
|
|
75
76
|
|
|
76
77
|
# Lists of CFGNodes indexed by the address of each block. Don't serialize
|
|
77
|
-
self._nodes_by_addr: DefaultDict[int,
|
|
78
|
+
self._nodes_by_addr: DefaultDict[int, list[CFGNode]] = defaultdict(list)
|
|
78
79
|
# CFGNodes dict indexed by block ID. Don't serialize
|
|
79
|
-
self._nodes:
|
|
80
|
+
self._nodes: dict[int, CFGNode] = {}
|
|
80
81
|
# addresses of CFGNodes to speed up get_any_node(..., anyaddr=True). Don't serialize
|
|
81
|
-
self._node_addrs:
|
|
82
|
+
self._node_addrs: list[int] = []
|
|
82
83
|
|
|
83
84
|
self.normalized = False
|
|
84
85
|
|
|
@@ -273,8 +274,8 @@ class CFGModel(Serializable):
|
|
|
273
274
|
return None
|
|
274
275
|
|
|
275
276
|
def get_any_node(
|
|
276
|
-
self, addr: int, is_syscall:
|
|
277
|
-
) ->
|
|
277
|
+
self, addr: int, is_syscall: bool | None = None, anyaddr: bool = False, force_fastpath: bool = False
|
|
278
|
+
) -> CFGNode | None:
|
|
278
279
|
"""
|
|
279
280
|
Get an arbitrary CFGNode (without considering their contexts) from our graph.
|
|
280
281
|
|
|
@@ -333,7 +334,7 @@ class CFGModel(Serializable):
|
|
|
333
334
|
|
|
334
335
|
return None
|
|
335
336
|
|
|
336
|
-
def get_all_nodes(self, addr: int, is_syscall: bool = None, anyaddr: bool = False) ->
|
|
337
|
+
def get_all_nodes(self, addr: int, is_syscall: bool = None, anyaddr: bool = False) -> list[CFGNode]:
|
|
337
338
|
"""
|
|
338
339
|
Get all CFGNodes whose address is the specified one.
|
|
339
340
|
|
|
@@ -352,7 +353,7 @@ class CFGModel(Serializable):
|
|
|
352
353
|
|
|
353
354
|
return results
|
|
354
355
|
|
|
355
|
-
def get_all_nodes_intersecting_region(self, addr: int, size: int = 1) ->
|
|
356
|
+
def get_all_nodes_intersecting_region(self, addr: int, size: int = 1) -> set[CFGNode]:
|
|
356
357
|
"""
|
|
357
358
|
Get all CFGNodes that intersect the given region.
|
|
358
359
|
|
|
@@ -373,8 +374,8 @@ class CFGModel(Serializable):
|
|
|
373
374
|
return self.graph.nodes()
|
|
374
375
|
|
|
375
376
|
def get_predecessors(
|
|
376
|
-
self, cfgnode: CFGNode, excluding_fakeret: bool = True, jumpkind:
|
|
377
|
-
) ->
|
|
377
|
+
self, cfgnode: CFGNode, excluding_fakeret: bool = True, jumpkind: str | None = None
|
|
378
|
+
) -> list[CFGNode]:
|
|
378
379
|
"""
|
|
379
380
|
Get predecessors of a node in the control flow graph.
|
|
380
381
|
|
|
@@ -409,8 +410,8 @@ class CFGModel(Serializable):
|
|
|
409
410
|
return predecessors
|
|
410
411
|
|
|
411
412
|
def get_successors(
|
|
412
|
-
self, node: CFGNode, excluding_fakeret: bool = True, jumpkind:
|
|
413
|
-
) ->
|
|
413
|
+
self, node: CFGNode, excluding_fakeret: bool = True, jumpkind: str | None = None
|
|
414
|
+
) -> list[CFGNode]:
|
|
414
415
|
"""
|
|
415
416
|
Get successors of a node in the control flow graph.
|
|
416
417
|
|
|
@@ -467,7 +468,7 @@ class CFGModel(Serializable):
|
|
|
467
468
|
|
|
468
469
|
def get_predecessors_and_jumpkinds(
|
|
469
470
|
self, node: CFGNode, excluding_fakeret: bool = True
|
|
470
|
-
) ->
|
|
471
|
+
) -> list[tuple[CFGNode, str]]:
|
|
471
472
|
"""
|
|
472
473
|
Get a list of tuples where the first element is the predecessor of the CFG node and the second element is the
|
|
473
474
|
jumpkind of the predecessor.
|
|
@@ -540,9 +541,7 @@ class CFGModel(Serializable):
|
|
|
540
541
|
# Memory data
|
|
541
542
|
#
|
|
542
543
|
|
|
543
|
-
def add_memory_data(
|
|
544
|
-
self, data_addr: int, data_type: Optional[MemoryDataSort], data_size: Optional[int] = None
|
|
545
|
-
) -> bool:
|
|
544
|
+
def add_memory_data(self, data_addr: int, data_type: MemoryDataSort | None, data_size: int | None = None) -> bool:
|
|
546
545
|
"""
|
|
547
546
|
Add a MemoryData entry to self.memory_data.
|
|
548
547
|
|
|
@@ -563,11 +562,11 @@ class CFGModel(Serializable):
|
|
|
563
562
|
|
|
564
563
|
def tidy_data_references(
|
|
565
564
|
self,
|
|
566
|
-
memory_data_addrs:
|
|
567
|
-
exec_mem_regions:
|
|
565
|
+
memory_data_addrs: list[int] | None = None,
|
|
566
|
+
exec_mem_regions: list[tuple[int, int]] | None = None,
|
|
568
567
|
xrefs: Optional["XRefManager"] = None,
|
|
569
568
|
seg_list: Optional["SegmentList"] = None,
|
|
570
|
-
data_type_guessing_handlers:
|
|
569
|
+
data_type_guessing_handlers: list[Callable] | None = None,
|
|
571
570
|
) -> bool:
|
|
572
571
|
"""
|
|
573
572
|
Go through all data references (or the ones as specified by memory_data_addrs) and determine their sizes and
|
|
@@ -748,8 +747,8 @@ class CFGModel(Serializable):
|
|
|
748
747
|
content_holder=None,
|
|
749
748
|
xrefs: Optional["XRefManager"] = None,
|
|
750
749
|
seg_list: Optional["SegmentList"] = None,
|
|
751
|
-
data_type_guessing_handlers:
|
|
752
|
-
extra_memory_regions:
|
|
750
|
+
data_type_guessing_handlers: list[Callable] | None = None,
|
|
751
|
+
extra_memory_regions: list[tuple[int, int]] | None = None,
|
|
753
752
|
):
|
|
754
753
|
"""
|
|
755
754
|
Make a guess to the data type.
|
|
@@ -887,7 +886,7 @@ class CFGModel(Serializable):
|
|
|
887
886
|
data_addr: int,
|
|
888
887
|
pointer_size: int,
|
|
889
888
|
max_size: int,
|
|
890
|
-
extra_memory_regions:
|
|
889
|
+
extra_memory_regions: list[tuple[int, int]] | None = None,
|
|
891
890
|
):
|
|
892
891
|
pointers_count = 0
|
|
893
892
|
|
|
@@ -948,7 +947,7 @@ class CFGModel(Serializable):
|
|
|
948
947
|
#
|
|
949
948
|
|
|
950
949
|
@staticmethod
|
|
951
|
-
def _addr_in_exec_memory_regions(addr: int, exec_mem_regions:
|
|
950
|
+
def _addr_in_exec_memory_regions(addr: int, exec_mem_regions: list[tuple[int, int]]) -> bool:
|
|
952
951
|
for start, end in exec_mem_regions:
|
|
953
952
|
if start <= addr < end:
|
|
954
953
|
return True
|
|
@@ -968,7 +967,7 @@ class CFGModel(Serializable):
|
|
|
968
967
|
addr: int,
|
|
969
968
|
size: int = 1,
|
|
970
969
|
kb: Optional["KnowledgeBase"] = None,
|
|
971
|
-
) ->
|
|
970
|
+
) -> set["Function"]:
|
|
972
971
|
"""
|
|
973
972
|
Find all functions with nodes intersecting [addr, addr + size).
|
|
974
973
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import traceback
|
|
2
2
|
import logging
|
|
3
|
-
from typing import TYPE_CHECKING, Union
|
|
3
|
+
from typing import TYPE_CHECKING, Union
|
|
4
4
|
|
|
5
5
|
from archinfo.arch_soot import SootAddressDescriptor
|
|
6
6
|
import archinfo
|
|
@@ -95,7 +95,7 @@ class CFGNode(Serializable):
|
|
|
95
95
|
self.function_address = function_address
|
|
96
96
|
self.block_id: Union["angr.analyses.cfg.cfg_job_base.BlockID", int] = block_id
|
|
97
97
|
self.thumb = thumb
|
|
98
|
-
self.byte_string:
|
|
98
|
+
self.byte_string: bytes | None = byte_string
|
|
99
99
|
|
|
100
100
|
self._name = None
|
|
101
101
|
if name is not None:
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
from typing import List, Optional
|
|
2
|
-
|
|
3
1
|
from ...serializable import Serializable
|
|
4
2
|
|
|
5
3
|
|
|
@@ -33,13 +31,13 @@ class IndirectJump(Serializable):
|
|
|
33
31
|
func_addr: int,
|
|
34
32
|
jumpkind: str,
|
|
35
33
|
stmt_idx: int,
|
|
36
|
-
resolved_targets:
|
|
34
|
+
resolved_targets: list[int] | None = None,
|
|
37
35
|
jumptable: bool = False,
|
|
38
|
-
jumptable_addr:
|
|
39
|
-
jumptable_size:
|
|
40
|
-
jumptable_entry_size:
|
|
41
|
-
jumptable_entries:
|
|
42
|
-
type_:
|
|
36
|
+
jumptable_addr: int | None = None,
|
|
37
|
+
jumptable_size: int | None = None,
|
|
38
|
+
jumptable_entry_size: int | None = None,
|
|
39
|
+
jumptable_entries: list[int] | None = None,
|
|
40
|
+
type_: int | None = IndirectJumpType.Unknown,
|
|
43
41
|
):
|
|
44
42
|
self.addr = addr
|
|
45
43
|
self.ins_addr = ins_addr
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
# pylint:disable=no-member
|
|
2
|
-
from typing import Optional
|
|
3
2
|
from ...protos import cfg_pb2
|
|
4
3
|
from ...serializable import Serializable
|
|
5
4
|
|
|
@@ -57,20 +56,20 @@ class MemoryData(Serializable):
|
|
|
57
56
|
self,
|
|
58
57
|
address: int,
|
|
59
58
|
size: int,
|
|
60
|
-
sort:
|
|
61
|
-
pointer_addr:
|
|
62
|
-
max_size:
|
|
63
|
-
reference_size:
|
|
59
|
+
sort: str | None, # temporary type
|
|
60
|
+
pointer_addr: int | None = None,
|
|
61
|
+
max_size: int | None = None,
|
|
62
|
+
reference_size: int | None = None,
|
|
64
63
|
):
|
|
65
64
|
self.addr: int = address
|
|
66
65
|
self.size: int = size
|
|
67
66
|
self.reference_size: int = reference_size
|
|
68
|
-
self.sort:
|
|
67
|
+
self.sort: str | None = sort
|
|
69
68
|
|
|
70
|
-
self.max_size:
|
|
71
|
-
self.pointer_addr:
|
|
69
|
+
self.max_size: int | None = max_size
|
|
70
|
+
self.pointer_addr: int | None = pointer_addr
|
|
72
71
|
|
|
73
|
-
self.content:
|
|
72
|
+
self.content: bytes | None = None # temporary annotation
|
|
74
73
|
|
|
75
74
|
def __eq__(self, other: "MemoryData"):
|
|
76
75
|
return (
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
from typing import Dict
|
|
2
|
-
|
|
3
1
|
from .plugin import KnowledgeBasePlugin
|
|
4
2
|
|
|
5
3
|
|
|
@@ -12,7 +10,7 @@ class CustomStrings(KnowledgeBasePlugin):
|
|
|
12
10
|
super().__init__(kb=kb)
|
|
13
11
|
|
|
14
12
|
self.string_id = 0
|
|
15
|
-
self.strings:
|
|
13
|
+
self.strings: dict[int, bytes] = {}
|
|
16
14
|
|
|
17
15
|
def allocate(self, s: bytes) -> int:
|
|
18
16
|
# de-duplication
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import
|
|
1
|
+
from typing import TYPE_CHECKING
|
|
2
2
|
import logging
|
|
3
3
|
|
|
4
4
|
import claripy
|
|
@@ -174,7 +174,7 @@ class DebugVariableManager(KnowledgeBasePlugin):
|
|
|
174
174
|
return self.add_variable(cle_var, index.start, index.stop)
|
|
175
175
|
|
|
176
176
|
# Methods similar to the once in VariableManager
|
|
177
|
-
def add_variable_list(self, vlist:
|
|
177
|
+
def add_variable_list(self, vlist: list[Variable], low_pc: int, high_pc: int):
|
|
178
178
|
"""
|
|
179
179
|
Add all variables in a list with the same visibility range
|
|
180
180
|
|
|
@@ -3,8 +3,7 @@ import logging
|
|
|
3
3
|
import networkx
|
|
4
4
|
import itertools
|
|
5
5
|
from collections import defaultdict
|
|
6
|
-
from
|
|
7
|
-
from typing import Type
|
|
6
|
+
from collections.abc import Iterable
|
|
8
7
|
|
|
9
8
|
from itanium_demangler import parse
|
|
10
9
|
|
|
@@ -90,9 +89,9 @@ class Function(Serializable):
|
|
|
90
89
|
addr,
|
|
91
90
|
name=None,
|
|
92
91
|
syscall=None,
|
|
93
|
-
is_simprocedure:
|
|
92
|
+
is_simprocedure: bool | None = None,
|
|
94
93
|
binary_name=None,
|
|
95
|
-
is_plt:
|
|
94
|
+
is_plt: bool | None = None,
|
|
96
95
|
returning=None,
|
|
97
96
|
alignment=False,
|
|
98
97
|
):
|
|
@@ -117,13 +116,13 @@ class Function(Serializable):
|
|
|
117
116
|
self.normalized = False
|
|
118
117
|
|
|
119
118
|
# block nodes at whose ends the function returns
|
|
120
|
-
self._ret_sites:
|
|
119
|
+
self._ret_sites: set[BlockNode] = set()
|
|
121
120
|
# block nodes at whose ends the function jumps out to another function (jumps outside)
|
|
122
|
-
self._jumpout_sites:
|
|
121
|
+
self._jumpout_sites: set[BlockNode] = set()
|
|
123
122
|
# block nodes at whose ends the function calls out to another non-returning function
|
|
124
|
-
self._callout_sites:
|
|
123
|
+
self._callout_sites: set[BlockNode] = set()
|
|
125
124
|
# block nodes that ends the function by returning out to another function (returns outside). This is rare.
|
|
126
|
-
self._retout_sites:
|
|
125
|
+
self._retout_sites: set[BlockNode] = set()
|
|
127
126
|
# block nodes (basic block nodes) at whose ends the function terminates
|
|
128
127
|
# in theory, if everything works fine, endpoints == ret_sites | jumpout_sites | callout_sites
|
|
129
128
|
self._endpoints = defaultdict(set)
|
|
@@ -142,10 +141,10 @@ class Function(Serializable):
|
|
|
142
141
|
self.retaddr_on_stack = False
|
|
143
142
|
self.sp_delta = 0
|
|
144
143
|
# Calling convention
|
|
145
|
-
self.calling_convention:
|
|
144
|
+
self.calling_convention: SimCC | None = None
|
|
146
145
|
# Function prototype
|
|
147
|
-
self.prototype:
|
|
148
|
-
self.prototype_libname:
|
|
146
|
+
self.prototype: SimTypeFunction | None = None
|
|
147
|
+
self.prototype_libname: str | None = None
|
|
149
148
|
self.is_prototype_guessed: bool = True
|
|
150
149
|
# Whether this function returns or not. `None` means it's not determined yet
|
|
151
150
|
self._returning = None
|
|
@@ -173,7 +172,7 @@ class Function(Serializable):
|
|
|
173
172
|
# Stack offsets of those arguments passed in stack variables
|
|
174
173
|
self._argument_stack_variables = []
|
|
175
174
|
|
|
176
|
-
self._project:
|
|
175
|
+
self._project: Project | None = None # will be initialized upon the first access to self.project
|
|
177
176
|
|
|
178
177
|
self.ran_cca = False # this is set by CompleteCallingConventions to avoid reprocessing failed functions
|
|
179
178
|
|
|
@@ -254,9 +253,9 @@ class Function(Serializable):
|
|
|
254
253
|
arch.name, platform=self.project.simos.name if self.project.simos is not None else None
|
|
255
254
|
)(arch)
|
|
256
255
|
|
|
257
|
-
self.calling_convention:
|
|
256
|
+
self.calling_convention: SimCC | None = cc
|
|
258
257
|
else:
|
|
259
|
-
self.calling_convention:
|
|
258
|
+
self.calling_convention: SimCC | None = None
|
|
260
259
|
|
|
261
260
|
@property
|
|
262
261
|
@deprecated(".is_alignment")
|
|
@@ -281,7 +280,7 @@ class Function(Serializable):
|
|
|
281
280
|
if self._project is None:
|
|
282
281
|
# try to set it from function manager
|
|
283
282
|
if self._function_manager is not None:
|
|
284
|
-
self._project:
|
|
283
|
+
self._project: Project | None = self._function_manager._kb._project
|
|
285
284
|
return self._project
|
|
286
285
|
|
|
287
286
|
@property
|
|
@@ -365,7 +364,7 @@ class Function(Serializable):
|
|
|
365
364
|
|
|
366
365
|
return self._local_block_addrs
|
|
367
366
|
|
|
368
|
-
def get_block(self, addr: int, size:
|
|
367
|
+
def get_block(self, addr: int, size: int | None = None, byte_string: bytes | None = None):
|
|
369
368
|
"""
|
|
370
369
|
Getting a block out of the current function.
|
|
371
370
|
|
|
@@ -396,7 +395,7 @@ class Function(Serializable):
|
|
|
396
395
|
# compatibility
|
|
397
396
|
_get_block = get_block
|
|
398
397
|
|
|
399
|
-
def get_block_size(self, addr: int) ->
|
|
398
|
+
def get_block_size(self, addr: int) -> int | None:
|
|
400
399
|
return self._block_sizes.get(addr, None)
|
|
401
400
|
|
|
402
401
|
@property
|
|
@@ -587,7 +586,7 @@ class Function(Serializable):
|
|
|
587
586
|
return False
|
|
588
587
|
|
|
589
588
|
def __str__(self):
|
|
590
|
-
s = f"Function {self.name} [{self.addr}]\n"
|
|
589
|
+
s = f"Function {self.name} [{self.addr:#x}]\n"
|
|
591
590
|
s += " Syscall: %s\n" % self.is_syscall
|
|
592
591
|
s += " SP difference: %d\n" % self.sp_delta
|
|
593
592
|
s += " Has return: %s\n" % self.has_return
|
|
@@ -664,7 +663,7 @@ class Function(Serializable):
|
|
|
664
663
|
return self.addr - self.binary.mapped_base
|
|
665
664
|
|
|
666
665
|
@property
|
|
667
|
-
def symbol(self) ->
|
|
666
|
+
def symbol(self) -> None | Symbol:
|
|
668
667
|
"""
|
|
669
668
|
:return: the function's Symbol, if any
|
|
670
669
|
"""
|
|
@@ -1586,7 +1585,7 @@ class Function(Serializable):
|
|
|
1586
1585
|
return ast.__str__()
|
|
1587
1586
|
return self.name
|
|
1588
1587
|
|
|
1589
|
-
def get_unambiguous_name(self, display_name:
|
|
1588
|
+
def get_unambiguous_name(self, display_name: str | None = None) -> str:
|
|
1590
1589
|
"""
|
|
1591
1590
|
Get a disambiguated function name.
|
|
1592
1591
|
|
|
@@ -1614,7 +1613,7 @@ class Function(Serializable):
|
|
|
1614
1613
|
n += self.binary_name + separator
|
|
1615
1614
|
return n + (display_name or self.name)
|
|
1616
1615
|
|
|
1617
|
-
def apply_definition(self, definition: str, calling_convention:
|
|
1616
|
+
def apply_definition(self, definition: str, calling_convention: SimCC | type[SimCC] | None = None) -> None:
|
|
1618
1617
|
if not definition.endswith(";"):
|
|
1619
1618
|
definition += ";"
|
|
1620
1619
|
func_def = parse_defns(definition, arch=self.project.arch)
|
|
@@ -1642,7 +1641,7 @@ class Function(Serializable):
|
|
|
1642
1641
|
else:
|
|
1643
1642
|
raise TypeError("calling_convention has to be one of: [SimCC, type(SimCC), None]")
|
|
1644
1643
|
|
|
1645
|
-
def
|
|
1644
|
+
def functions_reachable(self) -> set["Function"]:
|
|
1646
1645
|
"""
|
|
1647
1646
|
:return: The set of all functions that can be reached from the function represented by self.
|
|
1648
1647
|
"""
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# pylint:disable=raise-missing-from
|
|
2
|
-
from
|
|
2
|
+
from collections.abc import Generator
|
|
3
3
|
import logging
|
|
4
4
|
import collections.abc
|
|
5
5
|
import re
|
|
@@ -83,8 +83,8 @@ class FunctionManager(KnowledgeBasePlugin, collections.abc.Mapping):
|
|
|
83
83
|
super().__init__(kb=kb)
|
|
84
84
|
self.function_address_types = self._kb._project.arch.function_address_types
|
|
85
85
|
self.address_types = self._kb._project.arch.address_types
|
|
86
|
-
self._function_map:
|
|
87
|
-
self.function_addrs_set:
|
|
86
|
+
self._function_map: dict[int, Function] = FunctionDict(self, key_types=self.function_address_types)
|
|
87
|
+
self.function_addrs_set: set = set()
|
|
88
88
|
self.callgraph = networkx.MultiDiGraph()
|
|
89
89
|
self.block_map = {}
|
|
90
90
|
|
|
@@ -411,7 +411,7 @@ class FunctionManager(KnowledgeBasePlugin, collections.abc.Mapping):
|
|
|
411
411
|
except KeyError:
|
|
412
412
|
return None
|
|
413
413
|
|
|
414
|
-
def query(self, query: str) ->
|
|
414
|
+
def query(self, query: str) -> Function | None:
|
|
415
415
|
"""
|
|
416
416
|
Query for a function using selectors to disambiguate. Supported variations:
|
|
417
417
|
|
|
@@ -442,7 +442,7 @@ class FunctionManager(KnowledgeBasePlugin, collections.abc.Mapping):
|
|
|
442
442
|
|
|
443
443
|
return None
|
|
444
444
|
|
|
445
|
-
def function(self, addr=None, name=None, create=False, syscall=False, plt=None) ->
|
|
445
|
+
def function(self, addr=None, name=None, create=False, syscall=False, plt=None) -> Function | None:
|
|
446
446
|
"""
|
|
447
447
|
Get a function object from the function manager.
|
|
448
448
|
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
from typing import List
|
|
2
|
-
|
|
3
1
|
from .plugin import KnowledgeBasePlugin
|
|
4
2
|
|
|
5
3
|
|
|
@@ -22,7 +20,7 @@ class IndirectJumps(KnowledgeBasePlugin, dict):
|
|
|
22
20
|
for k, v in self.resolved.items():
|
|
23
21
|
o.resolved[k] = v
|
|
24
22
|
|
|
25
|
-
def update_resolved_addrs(self, indirect_address: int, resolved_addresses:
|
|
23
|
+
def update_resolved_addrs(self, indirect_address: int, resolved_addresses: list[int]):
|
|
26
24
|
# sanity check on usage
|
|
27
25
|
if indirect_address is None:
|
|
28
26
|
return
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import Union
|
|
1
|
+
from typing import Union
|
|
2
2
|
from enum import Enum, auto
|
|
3
3
|
|
|
4
4
|
import claripy
|
|
@@ -65,7 +65,7 @@ class Atom:
|
|
|
65
65
|
|
|
66
66
|
@staticmethod
|
|
67
67
|
def from_argument(
|
|
68
|
-
argument: SimFunctionArgument, arch: Arch, full_reg=False, sp:
|
|
68
|
+
argument: SimFunctionArgument, arch: Arch, full_reg=False, sp: int | None = None
|
|
69
69
|
) -> Union["Register", "MemoryLocation"]:
|
|
70
70
|
"""
|
|
71
71
|
Instanciate an `Atom` from a given argument.
|
|
@@ -91,7 +91,7 @@ class Atom:
|
|
|
91
91
|
raise TypeError("Argument type %s is not yet supported." % type(argument))
|
|
92
92
|
|
|
93
93
|
@staticmethod
|
|
94
|
-
def reg(thing:
|
|
94
|
+
def reg(thing: str | RegisterOffset, size: int | None = None, arch: Arch | None = None) -> "Register":
|
|
95
95
|
"""
|
|
96
96
|
Create a Register atom.
|
|
97
97
|
|
|
@@ -126,7 +126,7 @@ class Atom:
|
|
|
126
126
|
register = reg
|
|
127
127
|
|
|
128
128
|
@staticmethod
|
|
129
|
-
def mem(addr:
|
|
129
|
+
def mem(addr: SpOffset | HeapAddress | int, size: int, endness: str | None = None) -> "MemoryLocation":
|
|
130
130
|
"""
|
|
131
131
|
Create a MemoryLocation atom,
|
|
132
132
|
|
|
@@ -223,7 +223,7 @@ class Register(Atom):
|
|
|
223
223
|
"arch",
|
|
224
224
|
)
|
|
225
225
|
|
|
226
|
-
def __init__(self, reg_offset: RegisterOffset, size: int, arch:
|
|
226
|
+
def __init__(self, reg_offset: RegisterOffset, size: int, arch: Arch | None = None):
|
|
227
227
|
super().__init__(size)
|
|
228
228
|
|
|
229
229
|
self.reg_offset = reg_offset
|
|
@@ -254,14 +254,14 @@ class MemoryLocation(Atom):
|
|
|
254
254
|
"endness",
|
|
255
255
|
)
|
|
256
256
|
|
|
257
|
-
def __init__(self, addr:
|
|
257
|
+
def __init__(self, addr: SpOffset | HeapAddress | int, size: int, endness: str | None = None):
|
|
258
258
|
"""
|
|
259
259
|
:param int addr: The address of the beginning memory location slice.
|
|
260
260
|
:param int size: The size of the represented memory location, in bytes.
|
|
261
261
|
"""
|
|
262
262
|
super().__init__(size)
|
|
263
263
|
|
|
264
|
-
self.addr:
|
|
264
|
+
self.addr: SpOffset | int | claripy.ast.BV = addr
|
|
265
265
|
self.endness = endness
|
|
266
266
|
|
|
267
267
|
def __repr__(self):
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import
|
|
1
|
+
from typing import Optional, Literal, TypeVar, Generic
|
|
2
2
|
from dataclasses import dataclass
|
|
3
3
|
import logging
|
|
4
4
|
|
|
@@ -25,18 +25,18 @@ class DefinitionMatchPredicate:
|
|
|
25
25
|
internal class; don't worry about this.
|
|
26
26
|
"""
|
|
27
27
|
|
|
28
|
-
kind:
|
|
29
|
-
bbl_addr:
|
|
30
|
-
ins_addr:
|
|
31
|
-
variable:
|
|
32
|
-
variable_manager:
|
|
33
|
-
stack_offset:
|
|
34
|
-
reg_name:
|
|
35
|
-
heap_offset:
|
|
36
|
-
global_addr:
|
|
37
|
-
tmp_idx:
|
|
38
|
-
const_val:
|
|
39
|
-
extern:
|
|
28
|
+
kind: AtomKind | type[Atom] | None = None
|
|
29
|
+
bbl_addr: int | None = None
|
|
30
|
+
ins_addr: int | None = None
|
|
31
|
+
variable: SimVariable | None = None
|
|
32
|
+
variable_manager: VariableManagerInternal | None | Literal[False] = None
|
|
33
|
+
stack_offset: int | None = None
|
|
34
|
+
reg_name: str | int | None = None
|
|
35
|
+
heap_offset: int | None = None
|
|
36
|
+
global_addr: int | None = None
|
|
37
|
+
tmp_idx: int | None = None
|
|
38
|
+
const_val: int | None = None
|
|
39
|
+
extern: bool | None = None
|
|
40
40
|
|
|
41
41
|
@staticmethod
|
|
42
42
|
def construct(predicate: Optional["DefinitionMatchPredicate"] = None, **kwargs) -> "DefinitionMatchPredicate":
|
|
@@ -159,7 +159,7 @@ class Definition(Generic[A]):
|
|
|
159
159
|
"_hash",
|
|
160
160
|
)
|
|
161
161
|
|
|
162
|
-
def __init__(self, atom: A, codeloc: CodeLocation, dummy: bool = False, tags:
|
|
162
|
+
def __init__(self, atom: A, codeloc: CodeLocation, dummy: bool = False, tags: set[Tag] | None = None):
|
|
163
163
|
self.atom: A = atom
|
|
164
164
|
self.codeloc: CodeLocation = codeloc
|
|
165
165
|
self.dummy: bool = dummy
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
from typing import Dict, Tuple, Union, Set
|
|
2
|
-
|
|
3
1
|
import claripy
|
|
4
2
|
|
|
5
3
|
from .undefined import Undefined, UNDEFINED
|
|
@@ -16,10 +14,10 @@ class Environment:
|
|
|
16
14
|
|
|
17
15
|
__slots__ = ("_environment",)
|
|
18
16
|
|
|
19
|
-
def __init__(self, environment:
|
|
20
|
-
self._environment:
|
|
17
|
+
def __init__(self, environment: dict[str | Undefined, set[claripy.ast.Base]] = None):
|
|
18
|
+
self._environment: dict[str | Undefined, set[claripy.ast.Base]] = environment or {}
|
|
21
19
|
|
|
22
|
-
def get(self, names:
|
|
20
|
+
def get(self, names: set[str]) -> tuple[set[claripy.ast.Base], bool]:
|
|
23
21
|
"""
|
|
24
22
|
:param names: Potential values for the name of the environment variable to get the pointers of.
|
|
25
23
|
:return:
|
|
@@ -40,7 +38,7 @@ class Environment:
|
|
|
40
38
|
|
|
41
39
|
return pointers, has_unknown
|
|
42
40
|
|
|
43
|
-
def set(self, name:
|
|
41
|
+
def set(self, name: str | Undefined, pointers: set[claripy.ast.Base]):
|
|
44
42
|
"""
|
|
45
43
|
:param name: Name of the environment variable to which we will associate the pointers.
|
|
46
44
|
:param pointers: New addresses where the new values of the environment variable are located.
|
|
@@ -59,7 +57,7 @@ class Environment:
|
|
|
59
57
|
assert isinstance(other, Environment), "Cannot compare Environment with %s" % type(other).__name__
|
|
60
58
|
return self._environment == other._environment
|
|
61
59
|
|
|
62
|
-
def merge(self, *others: "Environment") ->
|
|
60
|
+
def merge(self, *others: "Environment") -> tuple["Environment", bool]:
|
|
63
61
|
new_env = self._environment
|
|
64
62
|
|
|
65
63
|
for other in others:
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
from typing import Union
|
|
2
|
-
|
|
3
1
|
from .undefined import Undefined
|
|
4
2
|
|
|
5
3
|
|
|
@@ -8,7 +6,7 @@ class HeapAddress:
|
|
|
8
6
|
The representation of an address on the heap.
|
|
9
7
|
"""
|
|
10
8
|
|
|
11
|
-
def __init__(self, value:
|
|
9
|
+
def __init__(self, value: int | Undefined):
|
|
12
10
|
self._value = value
|
|
13
11
|
|
|
14
12
|
@property
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
from typing import
|
|
1
|
+
from typing import TYPE_CHECKING
|
|
2
|
+
from collections.abc import Iterable
|
|
2
3
|
|
|
3
4
|
from .. import KnowledgeBasePlugin
|
|
4
5
|
from .rd_model import ReachingDefinitionsModel
|
|
@@ -39,7 +40,7 @@ class KeyDefinitionManager(KnowledgeBasePlugin):
|
|
|
39
40
|
|
|
40
41
|
def __init__(self, kb: "KnowledgeBase"):
|
|
41
42
|
super().__init__(kb=kb)
|
|
42
|
-
self.model_by_funcaddr:
|
|
43
|
+
self.model_by_funcaddr: dict[int, ReachingDefinitionsModel] = {}
|
|
43
44
|
|
|
44
45
|
def has_model(self, func_addr: int):
|
|
45
46
|
return func_addr in self.model_by_funcaddr
|