angr 9.2.102__py3-none-manylinux2014_x86_64.whl → 9.2.104__py3-none-manylinux2014_x86_64.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 +28 -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/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.104.dist-info}/METADATA +9 -11
- {angr-9.2.102.dist-info → angr-9.2.104.dist-info}/RECORD +239 -236
- {angr-9.2.102.dist-info → angr-9.2.104.dist-info}/LICENSE +0 -0
- {angr-9.2.102.dist-info → angr-9.2.104.dist-info}/WHEEL +0 -0
- {angr-9.2.102.dist-info → angr-9.2.104.dist-info}/entry_points.txt +0 -0
- {angr-9.2.102.dist-info → angr-9.2.104.dist-info}/top_level.txt +0 -0
angr/state_plugins/solver.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import functools
|
|
2
2
|
import time
|
|
3
3
|
import logging
|
|
4
|
-
from typing import
|
|
4
|
+
from typing import TypeVar, overload
|
|
5
5
|
|
|
6
6
|
from claripy import backend_manager
|
|
7
7
|
|
|
@@ -774,9 +774,9 @@ class SimSolver(SimStatePlugin):
|
|
|
774
774
|
|
|
775
775
|
@staticmethod
|
|
776
776
|
def _cast_to(
|
|
777
|
-
e:
|
|
778
|
-
solution:
|
|
779
|
-
cast_to:
|
|
777
|
+
e: claripy.ast.Bool | claripy.ast.BV | claripy.ast.FP,
|
|
778
|
+
solution: bool | float | int,
|
|
779
|
+
cast_to: type[CastType] | None,
|
|
780
780
|
) -> CastType:
|
|
781
781
|
"""
|
|
782
782
|
Casts a solution for the given expression to type `cast_to`.
|
|
@@ -813,22 +813,22 @@ class SimSolver(SimStatePlugin):
|
|
|
813
813
|
return solution
|
|
814
814
|
|
|
815
815
|
@overload
|
|
816
|
-
def eval_upto(self, e: claripy.ast.BV, n: int, cast_to: None = ..., **kwargs) ->
|
|
816
|
+
def eval_upto(self, e: claripy.ast.BV, n: int, cast_to: None = ..., **kwargs) -> list[int]: ...
|
|
817
817
|
|
|
818
818
|
@overload
|
|
819
|
-
def eval_upto(self, e: claripy.ast.BV, n: int, cast_to:
|
|
819
|
+
def eval_upto(self, e: claripy.ast.BV, n: int, cast_to: type[CastType], **kwargs) -> list[CastType]: ...
|
|
820
820
|
|
|
821
821
|
@overload
|
|
822
|
-
def eval_upto(self, e: claripy.ast.Bool, n: int, cast_to: None = ..., **kwargs) ->
|
|
822
|
+
def eval_upto(self, e: claripy.ast.Bool, n: int, cast_to: None = ..., **kwargs) -> list[bool]: ...
|
|
823
823
|
|
|
824
824
|
@overload
|
|
825
|
-
def eval_upto(self, e: claripy.ast.Bool, n: int, cast_to:
|
|
825
|
+
def eval_upto(self, e: claripy.ast.Bool, n: int, cast_to: type[CastType], **kwargs) -> list[CastType]: ...
|
|
826
826
|
|
|
827
827
|
@overload
|
|
828
|
-
def eval_upto(self, e: claripy.ast.FP, n: int, cast_to: None = ..., **kwargs) ->
|
|
828
|
+
def eval_upto(self, e: claripy.ast.FP, n: int, cast_to: None = ..., **kwargs) -> list[float]: ...
|
|
829
829
|
|
|
830
830
|
@overload
|
|
831
|
-
def eval_upto(self, e: claripy.ast.FP, n: int, cast_to:
|
|
831
|
+
def eval_upto(self, e: claripy.ast.FP, n: int, cast_to: type[CastType], **kwargs) -> list[CastType]: ...
|
|
832
832
|
|
|
833
833
|
def eval_upto(self, e, n, cast_to=None, **kwargs):
|
|
834
834
|
"""
|
|
@@ -856,19 +856,19 @@ class SimSolver(SimStatePlugin):
|
|
|
856
856
|
def eval(self, e: claripy.ast.BV, cast_to: None = ..., **kwargs) -> int: ...
|
|
857
857
|
|
|
858
858
|
@overload
|
|
859
|
-
def eval(self, e: claripy.ast.BV, cast_to:
|
|
859
|
+
def eval(self, e: claripy.ast.BV, cast_to: type[CastType], **kwargs) -> CastType: ...
|
|
860
860
|
|
|
861
861
|
@overload
|
|
862
862
|
def eval(self, e: claripy.ast.Bool, cast_to: None = ..., **kwargs) -> bool: ...
|
|
863
863
|
|
|
864
864
|
@overload
|
|
865
|
-
def eval(self, e: claripy.ast.Bool, cast_to:
|
|
865
|
+
def eval(self, e: claripy.ast.Bool, cast_to: type[CastType], **kwargs) -> CastType: ...
|
|
866
866
|
|
|
867
867
|
@overload
|
|
868
868
|
def eval(self, e: claripy.ast.FP, cast_to: None = ..., **kwargs) -> float: ...
|
|
869
869
|
|
|
870
870
|
@overload
|
|
871
|
-
def eval(self, e: claripy.ast.FP, cast_to:
|
|
871
|
+
def eval(self, e: claripy.ast.FP, cast_to: type[CastType], **kwargs) -> CastType: ...
|
|
872
872
|
|
|
873
873
|
def eval(self, e, cast_to=None, **kwargs):
|
|
874
874
|
"""
|
|
@@ -893,19 +893,19 @@ class SimSolver(SimStatePlugin):
|
|
|
893
893
|
def eval_one(self, e: claripy.ast.BV, cast_to: None = ..., **kwargs) -> int: ...
|
|
894
894
|
|
|
895
895
|
@overload
|
|
896
|
-
def eval_one(self, e: claripy.ast.BV, cast_to:
|
|
896
|
+
def eval_one(self, e: claripy.ast.BV, cast_to: type[CastType], **kwargs) -> CastType: ...
|
|
897
897
|
|
|
898
898
|
@overload
|
|
899
899
|
def eval_one(self, e: claripy.ast.Bool, cast_to: None = ..., **kwargs) -> bool: ...
|
|
900
900
|
|
|
901
901
|
@overload
|
|
902
|
-
def eval_one(self, e: claripy.ast.Bool, cast_to:
|
|
902
|
+
def eval_one(self, e: claripy.ast.Bool, cast_to: type[CastType], **kwargs) -> CastType: ...
|
|
903
903
|
|
|
904
904
|
@overload
|
|
905
905
|
def eval_one(self, e: claripy.ast.FP, cast_to: None = ..., **kwargs) -> float: ...
|
|
906
906
|
|
|
907
907
|
@overload
|
|
908
|
-
def eval_one(self, e: claripy.ast.FP, cast_to:
|
|
908
|
+
def eval_one(self, e: claripy.ast.FP, cast_to: type[CastType], **kwargs) -> CastType: ...
|
|
909
909
|
|
|
910
910
|
def eval_one(self, e, cast_to=None, **kwargs):
|
|
911
911
|
"""
|
|
@@ -928,22 +928,22 @@ class SimSolver(SimStatePlugin):
|
|
|
928
928
|
raise
|
|
929
929
|
|
|
930
930
|
@overload
|
|
931
|
-
def eval_atmost(self, e: claripy.ast.BV, n: int, cast_to: None = ..., **kwargs) ->
|
|
931
|
+
def eval_atmost(self, e: claripy.ast.BV, n: int, cast_to: None = ..., **kwargs) -> list[int]: ...
|
|
932
932
|
|
|
933
933
|
@overload
|
|
934
|
-
def eval_atmost(self, e: claripy.ast.BV, n: int, cast_to:
|
|
934
|
+
def eval_atmost(self, e: claripy.ast.BV, n: int, cast_to: type[CastType], **kwargs) -> list[CastType]: ...
|
|
935
935
|
|
|
936
936
|
@overload
|
|
937
|
-
def eval_atmost(self, e: claripy.ast.Bool, n: int, cast_to: None = ..., **kwargs) ->
|
|
937
|
+
def eval_atmost(self, e: claripy.ast.Bool, n: int, cast_to: None = ..., **kwargs) -> list[bool]: ...
|
|
938
938
|
|
|
939
939
|
@overload
|
|
940
|
-
def eval_atmost(self, e: claripy.ast.Bool, n: int, cast_to:
|
|
940
|
+
def eval_atmost(self, e: claripy.ast.Bool, n: int, cast_to: type[CastType], **kwargs) -> list[CastType]: ...
|
|
941
941
|
|
|
942
942
|
@overload
|
|
943
|
-
def eval_atmost(self, e: claripy.ast.FP, n: int, cast_to: None = ..., **kwargs) ->
|
|
943
|
+
def eval_atmost(self, e: claripy.ast.FP, n: int, cast_to: None = ..., **kwargs) -> list[float]: ...
|
|
944
944
|
|
|
945
945
|
@overload
|
|
946
|
-
def eval_atmost(self, e: claripy.ast.FP, n: int, cast_to:
|
|
946
|
+
def eval_atmost(self, e: claripy.ast.FP, n: int, cast_to: type[CastType], **kwargs) -> list[CastType]: ...
|
|
947
947
|
|
|
948
948
|
def eval_atmost(self, e, n, cast_to=None, **kwargs):
|
|
949
949
|
"""
|
|
@@ -964,22 +964,22 @@ class SimSolver(SimStatePlugin):
|
|
|
964
964
|
return r
|
|
965
965
|
|
|
966
966
|
@overload
|
|
967
|
-
def eval_atleast(self, e: claripy.ast.BV, n: int, cast_to: None = ..., **kwargs) ->
|
|
967
|
+
def eval_atleast(self, e: claripy.ast.BV, n: int, cast_to: None = ..., **kwargs) -> list[int]: ...
|
|
968
968
|
|
|
969
969
|
@overload
|
|
970
|
-
def eval_atleast(self, e: claripy.ast.BV, n: int, cast_to:
|
|
970
|
+
def eval_atleast(self, e: claripy.ast.BV, n: int, cast_to: type[CastType], **kwargs) -> list[CastType]: ...
|
|
971
971
|
|
|
972
972
|
@overload
|
|
973
|
-
def eval_atleast(self, e: claripy.ast.Bool, n: int, cast_to: None = ..., **kwargs) ->
|
|
973
|
+
def eval_atleast(self, e: claripy.ast.Bool, n: int, cast_to: None = ..., **kwargs) -> list[bool]: ...
|
|
974
974
|
|
|
975
975
|
@overload
|
|
976
|
-
def eval_atleast(self, e: claripy.ast.Bool, n: int, cast_to:
|
|
976
|
+
def eval_atleast(self, e: claripy.ast.Bool, n: int, cast_to: type[CastType], **kwargs) -> list[CastType]: ...
|
|
977
977
|
|
|
978
978
|
@overload
|
|
979
|
-
def eval_atleast(self, e: claripy.ast.FP, n: int, cast_to: None = ..., **kwargs) ->
|
|
979
|
+
def eval_atleast(self, e: claripy.ast.FP, n: int, cast_to: None = ..., **kwargs) -> list[float]: ...
|
|
980
980
|
|
|
981
981
|
@overload
|
|
982
|
-
def eval_atleast(self, e: claripy.ast.FP, n: int, cast_to:
|
|
982
|
+
def eval_atleast(self, e: claripy.ast.FP, n: int, cast_to: type[CastType], **kwargs) -> list[CastType]: ...
|
|
983
983
|
|
|
984
984
|
def eval_atleast(self, e, n, cast_to=None, **kwargs):
|
|
985
985
|
"""
|
|
@@ -999,22 +999,22 @@ class SimSolver(SimStatePlugin):
|
|
|
999
999
|
return r
|
|
1000
1000
|
|
|
1001
1001
|
@overload
|
|
1002
|
-
def eval_exact(self, e: claripy.ast.BV, n: int, cast_to: None = ..., **kwargs) ->
|
|
1002
|
+
def eval_exact(self, e: claripy.ast.BV, n: int, cast_to: None = ..., **kwargs) -> list[int]: ...
|
|
1003
1003
|
|
|
1004
1004
|
@overload
|
|
1005
|
-
def eval_exact(self, e: claripy.ast.BV, n: int, cast_to:
|
|
1005
|
+
def eval_exact(self, e: claripy.ast.BV, n: int, cast_to: type[CastType], **kwargs) -> list[CastType]: ...
|
|
1006
1006
|
|
|
1007
1007
|
@overload
|
|
1008
|
-
def eval_exact(self, e: claripy.ast.Bool, n: int, cast_to: None = ..., **kwargs) ->
|
|
1008
|
+
def eval_exact(self, e: claripy.ast.Bool, n: int, cast_to: None = ..., **kwargs) -> list[bool]: ...
|
|
1009
1009
|
|
|
1010
1010
|
@overload
|
|
1011
|
-
def eval_exact(self, e: claripy.ast.Bool, n: int, cast_to:
|
|
1011
|
+
def eval_exact(self, e: claripy.ast.Bool, n: int, cast_to: type[CastType], **kwargs) -> list[CastType]: ...
|
|
1012
1012
|
|
|
1013
1013
|
@overload
|
|
1014
|
-
def eval_exact(self, e: claripy.ast.FP, n: int, cast_to: None = ..., **kwargs) ->
|
|
1014
|
+
def eval_exact(self, e: claripy.ast.FP, n: int, cast_to: None = ..., **kwargs) -> list[float]: ...
|
|
1015
1015
|
|
|
1016
1016
|
@overload
|
|
1017
|
-
def eval_exact(self, e: claripy.ast.FP, n: int, cast_to:
|
|
1017
|
+
def eval_exact(self, e: claripy.ast.FP, n: int, cast_to: type[CastType], **kwargs) -> list[CastType]: ...
|
|
1018
1018
|
|
|
1019
1019
|
def eval_exact(self, e, n, cast_to=None, **kwargs):
|
|
1020
1020
|
"""
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# pylint:disable=abstract-method,wrong-import-position,unused-argument,missing-class-docstring,arguments-differ
|
|
2
|
-
from typing import
|
|
2
|
+
from typing import Tuple, Dict, Any, Optional
|
|
3
|
+
from collections.abc import Iterable
|
|
3
4
|
|
|
4
5
|
import claripy
|
|
5
6
|
|
|
@@ -118,7 +119,7 @@ class MemoryMixin(SimStatePlugin):
|
|
|
118
119
|
The ``inspect``, ``events``, and ``key`` parameters are for ``state.solver.Unconstrained``, if it is used.
|
|
119
120
|
"""
|
|
120
121
|
|
|
121
|
-
def _merge_values(self, values: Iterable[
|
|
122
|
+
def _merge_values(self, values: Iterable[tuple[Any, Any]], merged_size: int, **kwargs) -> Any | None:
|
|
122
123
|
"""
|
|
123
124
|
Override this method to provide value merging support.
|
|
124
125
|
|
|
@@ -128,7 +129,7 @@ class MemoryMixin(SimStatePlugin):
|
|
|
128
129
|
"""
|
|
129
130
|
raise NotImplementedError()
|
|
130
131
|
|
|
131
|
-
def _merge_labels(self, labels: Iterable[
|
|
132
|
+
def _merge_labels(self, labels: Iterable[dict], **kwargs) -> dict | None:
|
|
132
133
|
"""
|
|
133
134
|
Override this method to provide label merging support.
|
|
134
135
|
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
from typing import Optional
|
|
2
|
-
|
|
3
1
|
from ...state_plugins.sim_action import SimActionData, SimActionObject
|
|
4
2
|
from ... import sim_options as o
|
|
5
3
|
from . import MemoryMixin
|
|
@@ -62,7 +60,7 @@ class ActionsMixinLow(MemoryMixin):
|
|
|
62
60
|
action.actual_addrs.append(addr)
|
|
63
61
|
return super().load(addr, action=action, **kwargs)
|
|
64
62
|
|
|
65
|
-
def store(self, addr, data, action:
|
|
63
|
+
def store(self, addr, data, action: SimActionData | None = None, **kwargs):
|
|
66
64
|
if action is not None:
|
|
67
65
|
if action.actual_addrs is None:
|
|
68
66
|
action.actual_addrs = []
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
from typing import List
|
|
2
|
-
|
|
3
1
|
import claripy
|
|
4
2
|
|
|
5
3
|
from . import MemoryMixin
|
|
@@ -227,7 +225,7 @@ class AddressConcretizationMixin(MemoryMixin):
|
|
|
227
225
|
#
|
|
228
226
|
|
|
229
227
|
@staticmethod
|
|
230
|
-
def _interleave_ints(addrs:
|
|
228
|
+
def _interleave_ints(addrs: list[int]) -> list[int]:
|
|
231
229
|
"""
|
|
232
230
|
Take a list of integers and return a new list of integers where front and back integers interleave.
|
|
233
231
|
"""
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
# pylint:disable=arguments-differ,assignment-from-no-return,isinstance-second-argument-not-valid-type
|
|
2
|
-
from typing import Optional, Set
|
|
3
2
|
import logging
|
|
4
3
|
|
|
5
4
|
import claripy
|
|
@@ -20,7 +19,7 @@ class ConvenientMappingsMixin(MemoryMixin):
|
|
|
20
19
|
def __init__(self, **kwargs):
|
|
21
20
|
super().__init__(**kwargs)
|
|
22
21
|
|
|
23
|
-
self._symbolic_addrs:
|
|
22
|
+
self._symbolic_addrs: set = set()
|
|
24
23
|
self._name_mapping = ChainMapCOW()
|
|
25
24
|
self._hash_mapping = ChainMapCOW()
|
|
26
25
|
self._updated_mappings = set()
|
|
@@ -116,7 +115,7 @@ class ConvenientMappingsMixin(MemoryMixin):
|
|
|
116
115
|
d[m] = set()
|
|
117
116
|
self._updated_mappings.add((m, id(d)))
|
|
118
117
|
|
|
119
|
-
def _update_mappings(self, actual_addr: int, old_obj:
|
|
118
|
+
def _update_mappings(self, actual_addr: int, old_obj: claripy.ast.BV | None, new_obj: claripy.ast.BV):
|
|
120
119
|
if options.MEMORY_SYMBOLIC_BYTES_MAP in self.state.options:
|
|
121
120
|
if self.state.solver.symbolic(new_obj):
|
|
122
121
|
self._symbolic_addrs.add(actual_addr)
|
|
@@ -243,7 +242,7 @@ class ConvenientMappingsMixin(MemoryMixin):
|
|
|
243
242
|
|
|
244
243
|
# Computer an intersection between sets of memory addresses for each unique variable name. The eventual address
|
|
245
244
|
# set contains all addresses whose memory objects we should update.
|
|
246
|
-
addrs:
|
|
245
|
+
addrs: set | None = None
|
|
247
246
|
for v in old.variables:
|
|
248
247
|
v: str
|
|
249
248
|
if addrs is None:
|
|
@@ -120,7 +120,7 @@ class SpecialFillerMixin(MemoryMixin):
|
|
|
120
120
|
and self.state._special_memory_filler is not None
|
|
121
121
|
and type(addr) is int
|
|
122
122
|
):
|
|
123
|
-
return self.state._special_memory_filler(name, size * self.state.arch.byte_width, self.state)
|
|
123
|
+
return self.state._special_memory_filler(name, addr, size * self.state.arch.byte_width, self.state)
|
|
124
124
|
return super()._default_value(addr, size, name=name, **kwargs)
|
|
125
125
|
|
|
126
126
|
def copy(self, memo):
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from
|
|
1
|
+
from collections.abc import Iterable
|
|
2
2
|
|
|
3
3
|
from . import MemoryMixin
|
|
4
4
|
|
|
@@ -11,7 +11,7 @@ class LabelMergerMixin(MemoryMixin):
|
|
|
11
11
|
def __init__(self, *args, **kwargs):
|
|
12
12
|
super().__init__(*args, **kwargs)
|
|
13
13
|
|
|
14
|
-
def _merge_labels(self, labels: Iterable[
|
|
14
|
+
def _merge_labels(self, labels: Iterable[dict], **kwargs) -> dict | None:
|
|
15
15
|
new_label = {}
|
|
16
16
|
all_keys = set()
|
|
17
17
|
for label in labels:
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# pylint:disable=missing-class-docstring
|
|
2
|
-
from typing import
|
|
2
|
+
from typing import Any
|
|
3
|
+
from collections.abc import Iterable, Callable
|
|
3
4
|
|
|
4
5
|
from . import MemoryMixin
|
|
5
6
|
|
|
@@ -12,11 +13,11 @@ class MultiValueMergerMixin(MemoryMixin):
|
|
|
12
13
|
self._annotation_limit = annotation_limit
|
|
13
14
|
self._top_func: Callable = top_func
|
|
14
15
|
self._is_top_func: Callable = is_top_func
|
|
15
|
-
self._phi_maker:
|
|
16
|
+
self._phi_maker: Callable | None = phi_maker
|
|
16
17
|
|
|
17
18
|
super().__init__(*args, **kwargs)
|
|
18
19
|
|
|
19
|
-
def _merge_values(self, values: Iterable[
|
|
20
|
+
def _merge_values(self, values: Iterable[tuple[Any, Any]], merged_size: int, **kwargs):
|
|
20
21
|
values_set = {v for v, _ in values}
|
|
21
22
|
if self._phi_maker is not None:
|
|
22
23
|
phi_var = self._phi_maker(values_set)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from mmap import mmap
|
|
2
|
-
from typing import Union
|
|
2
|
+
from typing import Union
|
|
3
|
+
from collections.abc import Generator
|
|
3
4
|
import logging
|
|
4
5
|
|
|
5
6
|
import claripy
|
|
@@ -9,8 +10,8 @@ from .paged_memory_mixin import PagedMemoryMixin
|
|
|
9
10
|
|
|
10
11
|
l = logging.getLogger(__name__)
|
|
11
12
|
|
|
12
|
-
BackerType = Union[bytes, bytearray,
|
|
13
|
-
BackerIterType = Generator[
|
|
13
|
+
BackerType = Union[bytes, bytearray, list[int]]
|
|
14
|
+
BackerIterType = Generator[tuple[int, BackerType], None, None]
|
|
14
15
|
|
|
15
16
|
|
|
16
17
|
# since memoryview isn't pickleable, we make do...
|
|
@@ -28,7 +29,7 @@ class NotMemoryview:
|
|
|
28
29
|
|
|
29
30
|
|
|
30
31
|
class ClemoryBackerMixin(PagedMemoryMixin):
|
|
31
|
-
def __init__(self, cle_memory_backer:
|
|
32
|
+
def __init__(self, cle_memory_backer: None | cle.Loader | cle.Clemory = None, **kwargs):
|
|
32
33
|
super().__init__(**kwargs)
|
|
33
34
|
|
|
34
35
|
if isinstance(cle_memory_backer, cle.Loader):
|
|
@@ -96,7 +97,7 @@ class ClemoryBackerMixin(PagedMemoryMixin):
|
|
|
96
97
|
return self._data_from_lists_backer(addr, backer, backer_start, backer_iter)
|
|
97
98
|
raise TypeError("Unsupported backer type %s." % type(backer))
|
|
98
99
|
|
|
99
|
-
def _calc_page_starts(self, addr: int, backer_start: int, backer_length: int) ->
|
|
100
|
+
def _calc_page_starts(self, addr: int, backer_start: int, backer_length: int) -> tuple[int, int, int]:
|
|
100
101
|
# lord help me. why do I keep having to write code that looks like this
|
|
101
102
|
# why have I found myself entangled in a briar patch of address spaces embedded in other address spaces
|
|
102
103
|
if addr >= backer_start:
|
|
@@ -115,9 +116,9 @@ class ClemoryBackerMixin(PagedMemoryMixin):
|
|
|
115
116
|
def _data_from_bytes_backer(
|
|
116
117
|
self,
|
|
117
118
|
addr: int,
|
|
118
|
-
backer:
|
|
119
|
+
backer: bytes | bytearray,
|
|
119
120
|
backer_start: int,
|
|
120
|
-
backer_iter: Generator[
|
|
121
|
+
backer_iter: Generator[tuple[int, bytes | bytearray], None, None],
|
|
121
122
|
) -> claripy.ast.BV:
|
|
122
123
|
if backer_start <= addr and backer_start + len(backer) >= addr + self.page_size:
|
|
123
124
|
# fast case
|
|
@@ -144,7 +145,7 @@ class ClemoryBackerMixin(PagedMemoryMixin):
|
|
|
144
145
|
return data
|
|
145
146
|
|
|
146
147
|
def _data_from_lists_backer(
|
|
147
|
-
self, addr: int, backer:
|
|
148
|
+
self, addr: int, backer: list[int], backer_start: int, backer_iter: Generator[tuple[int, list[int]], None, None]
|
|
148
149
|
) -> claripy.ast.BV:
|
|
149
150
|
page_data = [0] * self.page_size
|
|
150
151
|
while backer_start < addr + self.page_size:
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import cffi
|
|
2
|
-
from typing import
|
|
2
|
+
from typing import Any
|
|
3
|
+
from collections.abc import Iterable
|
|
3
4
|
import logging
|
|
4
5
|
from collections import defaultdict
|
|
5
6
|
|
|
@@ -22,7 +23,7 @@ class PagedMemoryMixin(MemoryMixin):
|
|
|
22
23
|
"""
|
|
23
24
|
|
|
24
25
|
SUPPORTS_CONCRETE_LOAD = True
|
|
25
|
-
PAGE_TYPE:
|
|
26
|
+
PAGE_TYPE: type[PageType] = None # must be provided in subclass
|
|
26
27
|
|
|
27
28
|
def __init__(self, page_size=0x1000, default_permissions=3, permissions_map=None, page_kwargs=None, **kwargs):
|
|
28
29
|
super().__init__(**kwargs)
|
|
@@ -31,7 +32,7 @@ class PagedMemoryMixin(MemoryMixin):
|
|
|
31
32
|
|
|
32
33
|
self._permissions_map = permissions_map if permissions_map is not None else {}
|
|
33
34
|
self._default_permissions = default_permissions
|
|
34
|
-
self._pages:
|
|
35
|
+
self._pages: dict[int, PageType | None] = {}
|
|
35
36
|
|
|
36
37
|
@MemoryMixin.memo
|
|
37
38
|
def copy(self, memo):
|
|
@@ -105,7 +106,7 @@ class PagedMemoryMixin(MemoryMixin):
|
|
|
105
106
|
memory=self, memory_id="%s_%d" % (self.id, pageno), permissions=permissions, **self._extra_page_kwargs
|
|
106
107
|
)
|
|
107
108
|
|
|
108
|
-
def _divide_addr(self, addr: int) ->
|
|
109
|
+
def _divide_addr(self, addr: int) -> tuple[int, int]:
|
|
109
110
|
return divmod(addr, self.page_size)
|
|
110
111
|
|
|
111
112
|
def load(self, addr: int, size: int = None, endness=None, **kwargs):
|
|
@@ -252,7 +253,7 @@ class PagedMemoryMixin(MemoryMixin):
|
|
|
252
253
|
pageoff = 0
|
|
253
254
|
|
|
254
255
|
def merge(self, others: Iterable["PagedMemoryMixin"], merge_conditions, common_ancestor=None) -> bool:
|
|
255
|
-
changed_pages_and_offsets:
|
|
256
|
+
changed_pages_and_offsets: dict[int, set[int] | None] = {}
|
|
256
257
|
for o in others:
|
|
257
258
|
for changed_page, changed_offsets in self.changed_pages(o).items():
|
|
258
259
|
if changed_offsets is None:
|
|
@@ -295,7 +296,7 @@ class PagedMemoryMixin(MemoryMixin):
|
|
|
295
296
|
return bool(merged_bytes)
|
|
296
297
|
|
|
297
298
|
def compare(self, other: "PagedMemoryMixin") -> bool:
|
|
298
|
-
changed_pages_and_offsets:
|
|
299
|
+
changed_pages_and_offsets: dict[int, set[int] | None] = dict(self.changed_pages(other))
|
|
299
300
|
|
|
300
301
|
for page_no in sorted(changed_pages_and_offsets):
|
|
301
302
|
page = self._get_page(page_no, False)
|
|
@@ -555,7 +556,7 @@ class PagedMemoryMixin(MemoryMixin):
|
|
|
555
556
|
|
|
556
557
|
return data
|
|
557
558
|
|
|
558
|
-
def changed_bytes(self, other) ->
|
|
559
|
+
def changed_bytes(self, other) -> set[int]:
|
|
559
560
|
my_pages = set(self._pages)
|
|
560
561
|
other_pages = set(other._pages)
|
|
561
562
|
intersection = my_pages.intersection(other_pages)
|
|
@@ -583,12 +584,12 @@ class PagedMemoryMixin(MemoryMixin):
|
|
|
583
584
|
|
|
584
585
|
return changes
|
|
585
586
|
|
|
586
|
-
def changed_pages(self, other) ->
|
|
587
|
+
def changed_pages(self, other) -> dict[int, set[int] | None]:
|
|
587
588
|
my_pages = set(self._pages)
|
|
588
589
|
other_pages = set(other._pages)
|
|
589
590
|
intersection = my_pages.intersection(other_pages)
|
|
590
591
|
difference = my_pages.symmetric_difference(other_pages)
|
|
591
|
-
changes:
|
|
592
|
+
changes: dict[int, set[int] | None] = {d: None for d in difference}
|
|
592
593
|
|
|
593
594
|
for pageno in intersection:
|
|
594
595
|
my_page = self._pages[pageno]
|
|
@@ -608,7 +609,7 @@ class PagedMemoryMixin(MemoryMixin):
|
|
|
608
609
|
return changes
|
|
609
610
|
|
|
610
611
|
def _replace_all(self, addrs: Iterable[int], old: claripy.ast.BV, new: claripy.ast.BV):
|
|
611
|
-
page_offsets:
|
|
612
|
+
page_offsets: dict[set[int]] = defaultdict(set)
|
|
612
613
|
for addr in addrs:
|
|
613
614
|
page_no, page_offset = self._divide_addr(addr)
|
|
614
615
|
page_offsets[page_no].add(page_offset)
|
|
@@ -657,7 +658,7 @@ class PagedMemoryMixin(MemoryMixin):
|
|
|
657
658
|
class LabeledPagesMixin(PagedMemoryMixin):
|
|
658
659
|
def load_with_labels(
|
|
659
660
|
self, addr: int, size: int = None, endness=None, **kwargs
|
|
660
|
-
) ->
|
|
661
|
+
) -> tuple[claripy.ast.Base, tuple[tuple[int, int, int, Any]]]:
|
|
661
662
|
if endness is None:
|
|
662
663
|
endness = self.endness
|
|
663
664
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import
|
|
1
|
+
from typing import Any
|
|
2
2
|
|
|
3
3
|
import claripy
|
|
4
4
|
|
|
@@ -19,7 +19,7 @@ class CooperationBase:
|
|
|
19
19
|
"""
|
|
20
20
|
|
|
21
21
|
@classmethod
|
|
22
|
-
def _decompose_objects(cls, addr, data, endness, **kwargs) ->
|
|
22
|
+
def _decompose_objects(cls, addr, data, endness, **kwargs) -> tuple[Any, int, int]:
|
|
23
23
|
"""
|
|
24
24
|
A bidirectional generator. No idea if this is overengineered. Usage is that you send it a size to use
|
|
25
25
|
and it yields a tuple of three elements: the object to store for the next n bytes, the base address of the
|
|
@@ -58,11 +58,11 @@ class MemoryObjectMixin(CooperationBase):
|
|
|
58
58
|
@classmethod
|
|
59
59
|
def _compose_objects(
|
|
60
60
|
cls,
|
|
61
|
-
objects:
|
|
61
|
+
objects: list[list[tuple[int, SimMemoryObject]]],
|
|
62
62
|
size,
|
|
63
63
|
endness=None,
|
|
64
64
|
memory=None,
|
|
65
|
-
labels:
|
|
65
|
+
labels: list | None = None,
|
|
66
66
|
**kwargs,
|
|
67
67
|
):
|
|
68
68
|
c_objects = []
|
|
@@ -168,16 +168,16 @@ class MemoryObjectSetMixin(CooperationBase):
|
|
|
168
168
|
|
|
169
169
|
@classmethod
|
|
170
170
|
def _compose_objects(
|
|
171
|
-
cls, objects:
|
|
171
|
+
cls, objects: list[list[tuple[int, set[SimMemoryObject]]]], size, endness=None, memory=None, **kwargs
|
|
172
172
|
):
|
|
173
|
-
c_objects:
|
|
173
|
+
c_objects: list[tuple[int, SimMemoryObject | set[SimMemoryObject]]] = []
|
|
174
174
|
for objlist in objects:
|
|
175
175
|
for element in objlist:
|
|
176
176
|
if not c_objects or element[1] is not c_objects[-1][1]:
|
|
177
177
|
c_objects.append(element)
|
|
178
178
|
|
|
179
179
|
mask = (1 << memory.state.arch.bits) - 1
|
|
180
|
-
elements:
|
|
180
|
+
elements: list[set[claripy.ast.Base]] = []
|
|
181
181
|
for i, (a, objs) in enumerate(c_objects):
|
|
182
182
|
chopped_set = set()
|
|
183
183
|
if type(objs) is not set:
|
|
@@ -245,7 +245,7 @@ class MemoryObjectSetMixin(CooperationBase):
|
|
|
245
245
|
assert label is None # TODO: Support labels
|
|
246
246
|
|
|
247
247
|
size = yield
|
|
248
|
-
offset_to_mos:
|
|
248
|
+
offset_to_mos: dict[int, set[SimMemoryObject]] = {}
|
|
249
249
|
for offset, vs in data.items():
|
|
250
250
|
offset_to_mos[offset] = set()
|
|
251
251
|
for v in vs:
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
# pylint:disable=arguments-differ,unused-argument,no-member
|
|
2
|
-
from typing import Set, Optional
|
|
3
2
|
|
|
4
3
|
from angr.storage.memory_mixins import MemoryMixin
|
|
5
4
|
from angr.utils.segment_list import SegmentList
|
|
@@ -50,8 +49,8 @@ class HistoryTrackingMixin(RefcountMixin, MemoryMixin):
|
|
|
50
49
|
yield parent
|
|
51
50
|
parent = parent._parent
|
|
52
51
|
|
|
53
|
-
def changed_bytes(self, other, **kwargs) ->
|
|
54
|
-
candidates:
|
|
52
|
+
def changed_bytes(self, other, **kwargs) -> set[int] | None:
|
|
53
|
+
candidates: set[int] = set()
|
|
55
54
|
|
|
56
55
|
self_history_list = [self] + list(self.parents())
|
|
57
56
|
other_history_list = [other] + list(other.parents())
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
# pylint:disable=abstract-method,arguments-differ
|
|
2
2
|
import logging
|
|
3
|
-
from typing import Optional, List, Set, Tuple
|
|
4
3
|
|
|
5
4
|
import claripy
|
|
6
5
|
|
|
@@ -21,16 +20,16 @@ class ListPage(MemoryObjectMixin, PageBase):
|
|
|
21
20
|
def __init__(self, memory=None, content=None, sinkhole=None, mo_cmp=None, **kwargs):
|
|
22
21
|
super().__init__(**kwargs)
|
|
23
22
|
|
|
24
|
-
self.content:
|
|
23
|
+
self.content: DynamicDictList[SimMemoryObject | None] | None = (
|
|
25
24
|
DynamicDictList(max_size=memory.page_size, content=content) if content is not None else None
|
|
26
25
|
)
|
|
27
26
|
self.stored_offset = set()
|
|
28
27
|
if self.content is None:
|
|
29
28
|
if memory is not None:
|
|
30
|
-
self.content: DynamicDictList[
|
|
29
|
+
self.content: DynamicDictList[SimMemoryObject | None] = DynamicDictList(max_size=memory.page_size)
|
|
31
30
|
self._mo_cmp = mo_cmp
|
|
32
31
|
|
|
33
|
-
self.sinkhole:
|
|
32
|
+
self.sinkhole: SimMemoryObject | None = sinkhole
|
|
34
33
|
|
|
35
34
|
def copy(self, memo):
|
|
36
35
|
o = super().copy(memo)
|
|
@@ -114,19 +113,19 @@ class ListPage(MemoryObjectMixin, PageBase):
|
|
|
114
113
|
|
|
115
114
|
def merge(
|
|
116
115
|
self,
|
|
117
|
-
others:
|
|
116
|
+
others: list["ListPage"],
|
|
118
117
|
merge_conditions,
|
|
119
118
|
common_ancestor=None,
|
|
120
119
|
page_addr: int = None,
|
|
121
120
|
memory=None,
|
|
122
|
-
changed_offsets:
|
|
121
|
+
changed_offsets: set[int] | None = None,
|
|
123
122
|
):
|
|
124
123
|
if changed_offsets is None:
|
|
125
124
|
changed_offsets = set()
|
|
126
125
|
for other in others:
|
|
127
126
|
changed_offsets |= self.changed_bytes(other, page_addr)
|
|
128
127
|
|
|
129
|
-
all_pages:
|
|
128
|
+
all_pages: list["ListPage"] = [self] + others
|
|
130
129
|
if merge_conditions is None:
|
|
131
130
|
merge_conditions = [None] * len(all_pages)
|
|
132
131
|
|
|
@@ -244,7 +243,7 @@ class ListPage(MemoryObjectMixin, PageBase):
|
|
|
244
243
|
def changed_bytes(self, other: "ListPage", page_addr: int = None):
|
|
245
244
|
candidates = super().changed_bytes(other)
|
|
246
245
|
if candidates is None:
|
|
247
|
-
candidates:
|
|
246
|
+
candidates: set[int] = set()
|
|
248
247
|
if self.sinkhole is None:
|
|
249
248
|
candidates |= self.stored_offset
|
|
250
249
|
else:
|
|
@@ -260,7 +259,7 @@ class ListPage(MemoryObjectMixin, PageBase):
|
|
|
260
259
|
candidates.add(i)
|
|
261
260
|
|
|
262
261
|
byte_width = 8 # TODO: Introduce self.state if we want to use self.state.arch.byte_width
|
|
263
|
-
differences:
|
|
262
|
+
differences: set[int] = set()
|
|
264
263
|
for c in candidates:
|
|
265
264
|
s_contains = self._contains(c, page_addr)
|
|
266
265
|
o_contains = other._contains(c, page_addr)
|
|
@@ -331,14 +330,14 @@ class ListPage(MemoryObjectMixin, PageBase):
|
|
|
331
330
|
return new_mo
|
|
332
331
|
|
|
333
332
|
@staticmethod
|
|
334
|
-
def _resolve_range(mo: SimMemoryObject, page_addr: int, page_size) ->
|
|
333
|
+
def _resolve_range(mo: SimMemoryObject, page_addr: int, page_size) -> tuple[int, int]:
|
|
335
334
|
start = max(mo.base, page_addr)
|
|
336
335
|
end = min(mo.last_addr + 1, page_addr + page_size)
|
|
337
336
|
if end <= start:
|
|
338
337
|
l.warning("Nothing left of the memory object to store in SimPage.")
|
|
339
338
|
return start, end
|
|
340
339
|
|
|
341
|
-
def _get_object(self, start: int, page_addr: int) ->
|
|
340
|
+
def _get_object(self, start: int, page_addr: int) -> SimMemoryObject | None:
|
|
342
341
|
mo = self.content[start]
|
|
343
342
|
if mo is None:
|
|
344
343
|
return None
|