angr 9.2.115__py3-none-manylinux2014_aarch64.whl → 9.2.117__py3-none-manylinux2014_aarch64.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/__main__.py +1 -1
- angr/analyses/cfg/cfg_emulated.py +4 -4
- angr/analyses/cfg/indirect_jump_resolvers/jumptable.py +7 -7
- angr/analyses/cfg/indirect_jump_resolvers/mips_elf_fast.py +3 -2
- angr/analyses/decompiler/optimization_passes/stack_canary_simplifier.py +5 -1
- angr/analyses/decompiler/structured_codegen/c.py +10 -13
- angr/analyses/decompiler/structuring/dream.py +3 -4
- angr/analyses/decompiler/structuring/phoenix.py +4 -5
- angr/analyses/decompiler/structuring/structurer_base.py +2 -3
- angr/analyses/decompiler/structuring/structurer_nodes.py +3 -3
- angr/analyses/identifier/functions/free.py +3 -1
- angr/analyses/identifier/identify.py +13 -15
- angr/analyses/identifier/runner.py +2 -2
- angr/analyses/reaching_definitions/dep_graph.py +62 -5
- angr/analyses/reaching_definitions/function_handler_library/__init__.py +11 -0
- angr/analyses/reaching_definitions/function_handler_library/stdio.py +15 -13
- angr/analyses/reaching_definitions/function_handler_library/stdlib.py +17 -11
- angr/analyses/reaching_definitions/function_handler_library/string.py +1 -1
- angr/analyses/reaching_definitions/function_handler_library/unistd.py +2 -2
- angr/analyses/reaching_definitions/rd_state.py +26 -29
- angr/analyses/variable_recovery/engine_vex.py +0 -9
- angr/analyses/vfg.py +4 -4
- angr/calling_conventions.py +4 -2
- angr/concretization_strategies/any_named.py +3 -1
- angr/concretization_strategies/controlled_data.py +4 -2
- angr/concretization_strategies/signed_add.py +3 -1
- angr/engines/concrete.py +3 -1
- angr/engines/pcode/behavior.py +2 -0
- angr/engines/pcode/cc.py +2 -0
- angr/engines/pcode/emulate.py +4 -4
- angr/engines/pcode/engine.py +3 -7
- angr/engines/soot/engine.py +7 -6
- angr/engines/soot/expressions/constants.py +6 -5
- angr/engines/soot/expressions/newArray.py +3 -1
- angr/engines/soot/expressions/newMultiArray.py +3 -1
- angr/engines/soot/statements/goto.py +3 -1
- angr/engines/soot/statements/if_.py +3 -1
- angr/engines/soot/statements/switch.py +3 -1
- angr/engines/soot/statements/throw.py +4 -2
- angr/engines/soot/values/arrayref.py +5 -5
- angr/engines/unicorn.py +8 -7
- angr/engines/vex/heavy/concretizers.py +6 -6
- angr/engines/vex/heavy/dirty.py +20 -22
- angr/engines/vex/heavy/heavy.py +4 -8
- angr/exploration_techniques/director.py +1 -1
- angr/exploration_techniques/driller_core.py +3 -1
- angr/exploration_techniques/tracer.py +2 -1
- angr/knowledge_plugins/key_definitions/live_definitions.py +12 -13
- angr/procedures/cgc/allocate.py +8 -10
- angr/procedures/cgc/deallocate.py +10 -3
- angr/procedures/cgc/fdwait.py +15 -13
- angr/procedures/cgc/random.py +11 -5
- angr/procedures/cgc/receive.py +5 -3
- angr/procedures/cgc/transmit.py +5 -4
- angr/procedures/glibc/__libc_start_main.py +5 -4
- angr/procedures/java_jni/__init__.py +4 -4
- angr/procedures/java_jni/array_operations.py +3 -1
- angr/procedures/java_lang/string.py +1 -1
- angr/procedures/java_util/random.py +3 -1
- angr/procedures/libc/access.py +4 -2
- angr/procedures/libc/feof.py +4 -3
- angr/procedures/libc/fgetc.py +3 -1
- angr/procedures/libc/fgets.py +5 -5
- angr/procedures/libc/fopen.py +5 -4
- angr/procedures/libc/fread.py +4 -3
- angr/procedures/libc/fseek.py +4 -3
- angr/procedures/libc/getdelim.py +7 -4
- angr/procedures/libc/gets.py +4 -2
- angr/procedures/libc/memcmp.py +18 -15
- angr/procedures/libc/memset.py +9 -7
- angr/procedures/libc/puts.py +3 -1
- angr/procedures/libc/snprintf.py +4 -2
- angr/procedures/libc/sprintf.py +3 -1
- angr/procedures/libc/strchr.py +6 -3
- angr/procedures/libc/strcmp.py +5 -3
- angr/procedures/libc/strlen.py +3 -3
- angr/procedures/libc/strncmp.py +28 -28
- angr/procedures/libc/strncpy.py +5 -2
- angr/procedures/libc/strstr.py +10 -7
- angr/procedures/libc/strtol.py +32 -34
- angr/procedures/libc/tolower.py +3 -1
- angr/procedures/libc/toupper.py +3 -1
- angr/procedures/linux_kernel/fstat.py +13 -13
- angr/procedures/linux_kernel/fstat64.py +15 -15
- angr/procedures/linux_kernel/lseek.py +5 -3
- angr/procedures/linux_kernel/sigaction.py +4 -2
- angr/procedures/linux_kernel/sigprocmask.py +5 -3
- angr/procedures/linux_kernel/tgkill.py +3 -1
- angr/procedures/linux_kernel/time.py +7 -4
- angr/procedures/msvcr/fmode.py +3 -1
- angr/procedures/ntdll/exceptions.py +3 -1
- angr/procedures/posix/bzero.py +3 -1
- angr/procedures/posix/fdopen.py +6 -4
- angr/procedures/posix/fork.py +6 -4
- angr/procedures/posix/mmap.py +6 -3
- angr/procedures/posix/poll.py +6 -5
- angr/procedures/posix/readdir.py +10 -7
- angr/procedures/posix/select.py +4 -2
- angr/procedures/posix/send.py +4 -3
- angr/procedures/posix/sigaction.py +4 -2
- angr/procedures/posix/sim_time.py +3 -1
- angr/procedures/posix/strcasecmp.py +3 -1
- angr/procedures/posix/strtok_r.py +10 -7
- angr/procedures/stubs/Redirect.py +3 -1
- angr/procedures/stubs/ReturnChar.py +3 -3
- angr/procedures/stubs/UserHook.py +3 -1
- angr/procedures/stubs/b64_decode.py +3 -1
- angr/procedures/stubs/crazy_scanf.py +6 -4
- angr/procedures/stubs/format_parser.py +13 -15
- angr/procedures/tracer/receive.py +3 -1
- angr/procedures/tracer/transmit.py +3 -1
- angr/procedures/win32/GetLastInputInfo.py +4 -2
- angr/procedures/win32/GetProcessAffinityMask.py +4 -2
- angr/procedures/win32/gethostbyname.py +3 -1
- angr/procedures/win32/heap.py +3 -1
- angr/procedures/win32/local_storage.py +4 -2
- angr/procedures/win32/sim_time.py +7 -4
- angr/procedures/win_user32/chars.py +4 -2
- angr/procedures/win_user32/messagebox.py +3 -1
- angr/sim_procedure.py +7 -7
- angr/sim_state.py +10 -7
- angr/sim_type.py +3 -3
- angr/simos/cgc.py +2 -2
- angr/simos/simos.py +5 -4
- angr/simos/windows.py +5 -5
- angr/state_plugins/heap/heap_brk.py +5 -3
- angr/state_plugins/heap/heap_ptmalloc.py +5 -4
- angr/state_plugins/history.py +7 -5
- angr/state_plugins/light_registers.py +2 -2
- angr/state_plugins/plugin.py +2 -2
- angr/state_plugins/posix.py +28 -26
- angr/state_plugins/preconstrainer.py +2 -1
- angr/state_plugins/solver.py +11 -27
- angr/state_plugins/trace_additions.py +9 -13
- angr/state_plugins/uc_manager.py +4 -2
- angr/state_plugins/unicorn_engine.py +1 -1
- angr/state_plugins/view.py +1 -1
- angr/storage/file.py +21 -26
- angr/storage/memory_mixins/actions_mixin.py +4 -2
- angr/storage/memory_mixins/address_concretization_mixin.py +3 -3
- angr/storage/memory_mixins/default_filler_mixin.py +6 -4
- angr/storage/memory_mixins/javavm_memory/javavm_memory_mixin.py +7 -5
- angr/storage/memory_mixins/paged_memory/paged_memory_mixin.py +1 -1
- angr/storage/memory_mixins/paged_memory/pages/cooperation.py +2 -1
- angr/storage/memory_mixins/regioned_memory/abstract_merger_mixin.py +1 -1
- angr/storage/memory_mixins/regioned_memory/region_data.py +3 -1
- angr/storage/memory_mixins/regioned_memory/region_meta_mixin.py +1 -1
- angr/storage/memory_mixins/regioned_memory/regioned_memory_mixin.py +5 -4
- angr/storage/memory_mixins/simple_interface_mixin.py +2 -2
- angr/storage/memory_mixins/size_resolution_mixin.py +3 -1
- angr/storage/memory_mixins/slotted_memory.py +1 -1
- angr/storage/memory_mixins/smart_find_mixin.py +2 -2
- angr/storage/memory_mixins/symbolic_merger_mixin.py +5 -3
- angr/tablespecs.py +3 -3
- {angr-9.2.115.dist-info → angr-9.2.117.dist-info}/METADATA +7 -7
- {angr-9.2.115.dist-info → angr-9.2.117.dist-info}/RECORD +161 -161
- {angr-9.2.115.dist-info → angr-9.2.117.dist-info}/WHEEL +1 -1
- {angr-9.2.115.dist-info → angr-9.2.117.dist-info}/LICENSE +0 -0
- {angr-9.2.115.dist-info → angr-9.2.117.dist-info}/entry_points.txt +0 -0
- {angr-9.2.115.dist-info → angr-9.2.117.dist-info}/top_level.txt +0 -0
|
@@ -16,9 +16,9 @@ if TYPE_CHECKING:
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
class EnvironAtom(Atom):
|
|
19
|
-
def __init__(self, name: str | None):
|
|
19
|
+
def __init__(self, size: int, name: str | None):
|
|
20
20
|
self.name = name
|
|
21
|
-
super().__init__(
|
|
21
|
+
super().__init__(size)
|
|
22
22
|
|
|
23
23
|
def _identity(self):
|
|
24
24
|
if self.name is not None:
|
|
@@ -31,9 +31,9 @@ class EnvironAtom(Atom):
|
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
class SystemAtom(Atom):
|
|
34
|
-
def __init__(self):
|
|
34
|
+
def __init__(self, size: int = 1):
|
|
35
35
|
self.nonce = random.randint(0, 999999999999)
|
|
36
|
-
super().__init__(
|
|
36
|
+
super().__init__(size)
|
|
37
37
|
|
|
38
38
|
def _identity(self):
|
|
39
39
|
return (self.nonce,)
|
|
@@ -49,7 +49,7 @@ class ExecveAtom(Atom):
|
|
|
49
49
|
super().__init__(size)
|
|
50
50
|
|
|
51
51
|
def _identity(self):
|
|
52
|
-
return (self.nonce,)
|
|
52
|
+
return (self.nonce, self.idx)
|
|
53
53
|
|
|
54
54
|
def __repr__(self):
|
|
55
55
|
return f"<ExecveAtom {self.idx}>"
|
|
@@ -61,7 +61,10 @@ class LibcStdlibHandlers(FunctionHandler):
|
|
|
61
61
|
buf_atoms = state.deref(data.args_atoms[0], DerefSize.NULL_TERMINATE)
|
|
62
62
|
buf_value = state.get_concrete_value(buf_atoms, cast_to=bytes)
|
|
63
63
|
if buf_value is not None:
|
|
64
|
-
|
|
64
|
+
try:
|
|
65
|
+
buf_value = int(buf_value.decode().strip("\0"))
|
|
66
|
+
except ValueError:
|
|
67
|
+
buf_value = 0
|
|
65
68
|
data.depends(data.ret_atoms, buf_atoms, value=buf_value)
|
|
66
69
|
|
|
67
70
|
@FunctionCallDataUnwrapped.decorate
|
|
@@ -92,7 +95,7 @@ class LibcStdlibHandlers(FunctionHandler):
|
|
|
92
95
|
heap_ptr = state.heap_allocator.allocate(2)
|
|
93
96
|
heap_atom = state.deref(heap_ptr, 2)
|
|
94
97
|
heap_value = claripy.BVS("weh", 8).concat(claripy.BVV(0, 8))
|
|
95
|
-
data.depends(heap_atom, EnvironAtom(name_value), value=heap_value)
|
|
98
|
+
data.depends(heap_atom, EnvironAtom(2, name_value), value=heap_value)
|
|
96
99
|
data.depends(data.ret_atoms, value=state.heap_address(heap_ptr))
|
|
97
100
|
|
|
98
101
|
@FunctionCallDataUnwrapped.decorate
|
|
@@ -105,12 +108,15 @@ class LibcStdlibHandlers(FunctionHandler):
|
|
|
105
108
|
|
|
106
109
|
src_atom = state.deref(data.args_atoms[1], DerefSize.NULL_TERMINATE)
|
|
107
110
|
src_value = state.get_values(src_atom)
|
|
108
|
-
data.depends(
|
|
111
|
+
data.depends(
|
|
112
|
+
EnvironAtom(len(src_value) // 8 if src_value is not None else 1, name_value), src_atom, value=src_value
|
|
113
|
+
)
|
|
109
114
|
|
|
110
115
|
@FunctionCallDataUnwrapped.decorate
|
|
111
116
|
def handle_impl_system(self, state: ReachingDefinitionsState, data: FunctionCallDataUnwrapped):
|
|
112
117
|
buf_atom = state.deref(data.args_atoms[0], DerefSize.NULL_TERMINATE)
|
|
113
|
-
|
|
118
|
+
buf_value = state.get_values(buf_atom)
|
|
119
|
+
data.depends(SystemAtom(len(buf_value) // 8 if buf_value is not None else 1), buf_atom, value=buf_value)
|
|
114
120
|
|
|
115
121
|
handle_impl_popen = handle_impl_execl = handle_impl_system
|
|
116
122
|
|
|
@@ -131,12 +137,12 @@ class LibcStdlibHandlers(FunctionHandler):
|
|
|
131
137
|
# unknown if array continues
|
|
132
138
|
break
|
|
133
139
|
|
|
134
|
-
argv_deref_concrete = state.
|
|
140
|
+
argv_deref_concrete = state.get_one_value(argv_deref_atom)
|
|
135
141
|
if argv_deref_concrete is None:
|
|
136
142
|
# unknown if array continues
|
|
137
143
|
break
|
|
138
144
|
|
|
139
|
-
if argv_deref_concrete == 0:
|
|
145
|
+
if (argv_deref_concrete == 0).is_true():
|
|
140
146
|
# End of array
|
|
141
147
|
break
|
|
142
148
|
|
|
@@ -6,7 +6,7 @@ from angr.knowledge_plugins.key_definitions.live_definitions import DerefSize
|
|
|
6
6
|
# pylint: disable=no-self-use,missing-class-docstring,unused-argument
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
class
|
|
9
|
+
class LibcStringHandlers(FunctionHandler):
|
|
10
10
|
@FunctionCallDataUnwrapped.decorate
|
|
11
11
|
def handle_impl_strcat(self, state: ReachingDefinitionsState, data: FunctionCallDataUnwrapped):
|
|
12
12
|
src0_atom = state.deref(data.args_atoms[0], DerefSize.NULL_TERMINATE)
|
|
@@ -10,7 +10,7 @@ class LibcUnistdHandlers(FunctionHandler):
|
|
|
10
10
|
def handle_impl_read(self, state: ReachingDefinitionsState, data: FunctionCallDataUnwrapped):
|
|
11
11
|
size = state.get_concrete_value(data.args_atoms[2]) or 1
|
|
12
12
|
dst_atom = state.deref(data.args_atoms[1], size)
|
|
13
|
-
data.depends(dst_atom, StdinAtom(data.function.name))
|
|
13
|
+
data.depends(dst_atom, StdinAtom(data.function.name, size))
|
|
14
14
|
|
|
15
15
|
handle_impl_recv = handle_impl_recvfrom = handle_impl_read
|
|
16
16
|
|
|
@@ -18,6 +18,6 @@ class LibcUnistdHandlers(FunctionHandler):
|
|
|
18
18
|
def handle_impl_write(self, state: ReachingDefinitionsState, data: FunctionCallDataUnwrapped):
|
|
19
19
|
size = state.get_concrete_value(data.args_atoms[2]) or 1
|
|
20
20
|
src_atom = state.deref(data.args_atoms[1], size)
|
|
21
|
-
data.depends(StdoutAtom(data.function.name), src_atom, value=state.get_values(src_atom))
|
|
21
|
+
data.depends(StdoutAtom(data.function.name, size), src_atom, value=state.get_values(src_atom))
|
|
22
22
|
|
|
23
23
|
handle_impl_send = handle_impl_write
|
|
@@ -9,6 +9,7 @@ from angr.misc.ux import deprecated
|
|
|
9
9
|
from angr.knowledge_plugins.key_definitions.environment import Environment
|
|
10
10
|
from angr.knowledge_plugins.key_definitions.tag import Tag
|
|
11
11
|
from angr.knowledge_plugins.key_definitions.heap_address import HeapAddress
|
|
12
|
+
from angr.knowledge_plugins.key_definitions.definition import A
|
|
12
13
|
from angr.engines.light import SpOffset
|
|
13
14
|
from angr.code_location import CodeLocation
|
|
14
15
|
from ...storage.memory_mixins.paged_memory.pages.multi_values import MultiValues
|
|
@@ -90,7 +91,7 @@ class ReachingDefinitionsState:
|
|
|
90
91
|
heap_allocator: HeapAllocator = None,
|
|
91
92
|
environment: Environment = None,
|
|
92
93
|
sp_adjusted: bool = False,
|
|
93
|
-
all_definitions: set[Definition] | None = None,
|
|
94
|
+
all_definitions: set[Definition[A]] | None = None,
|
|
94
95
|
initializer: Optional["RDAStateInitializer"] = None,
|
|
95
96
|
element_limit: int = 5,
|
|
96
97
|
merge_into_tops: bool = True,
|
|
@@ -106,12 +107,12 @@ class ReachingDefinitionsState:
|
|
|
106
107
|
self._sp_adjusted: bool = sp_adjusted
|
|
107
108
|
self._element_limit: int = element_limit
|
|
108
109
|
|
|
109
|
-
self.all_definitions: set[Definition] = set() if all_definitions is None else all_definitions
|
|
110
|
+
self.all_definitions: set[Definition[A]] = set() if all_definitions is None else all_definitions
|
|
110
111
|
|
|
111
112
|
self.heap_allocator = heap_allocator or HeapAllocator(canonical_size)
|
|
112
113
|
self._environment: Environment = environment or Environment()
|
|
113
114
|
|
|
114
|
-
self.codeloc_uses: set[Definition] = set()
|
|
115
|
+
self.codeloc_uses: set[Definition[A]] = set()
|
|
115
116
|
|
|
116
117
|
# have we observed an exit statement or not during the analysis of the *last instruction* of a block? we should
|
|
117
118
|
# not perform any sp updates if it is the case. this is for handling conditional returns in ARM binaries.
|
|
@@ -189,7 +190,7 @@ class ReachingDefinitionsState:
|
|
|
189
190
|
return n - 2**self.arch.bits
|
|
190
191
|
return n
|
|
191
192
|
|
|
192
|
-
def annotate_with_def(self, symvar: claripy.ast.Base, definition: Definition) -> claripy.ast.Base:
|
|
193
|
+
def annotate_with_def(self, symvar: claripy.ast.Base, definition: Definition[A]) -> claripy.ast.Base:
|
|
193
194
|
"""
|
|
194
195
|
|
|
195
196
|
:param symvar:
|
|
@@ -198,14 +199,14 @@ class ReachingDefinitionsState:
|
|
|
198
199
|
"""
|
|
199
200
|
return self.live_definitions.annotate_with_def(symvar, definition)
|
|
200
201
|
|
|
201
|
-
def annotate_mv_with_def(self, mv: MultiValues, definition: Definition) -> MultiValues:
|
|
202
|
+
def annotate_mv_with_def(self, mv: MultiValues, definition: Definition[A]) -> MultiValues:
|
|
202
203
|
return MultiValues(
|
|
203
204
|
offset_to_values={
|
|
204
205
|
offset: {self.annotate_with_def(value, definition) for value in values} for offset, values in mv.items()
|
|
205
206
|
}
|
|
206
207
|
)
|
|
207
208
|
|
|
208
|
-
def extract_defs(self, symvar: claripy.ast.Base) -> Iterator[Definition]:
|
|
209
|
+
def extract_defs(self, symvar: claripy.ast.Base) -> Iterator[Definition[A]]:
|
|
209
210
|
yield from self.live_definitions.extract_defs(symvar)
|
|
210
211
|
|
|
211
212
|
#
|
|
@@ -364,9 +365,9 @@ class ReachingDefinitionsState:
|
|
|
364
365
|
tags: set[Tag] = None,
|
|
365
366
|
endness=None, # XXX destroy
|
|
366
367
|
annotated: bool = False,
|
|
367
|
-
uses: set[Definition] | None = None,
|
|
368
|
+
uses: set[Definition[A]] | None = None,
|
|
368
369
|
override_codeloc: CodeLocation | None = None,
|
|
369
|
-
) -> tuple[MultiValues | None, set[Definition]]:
|
|
370
|
+
) -> tuple[MultiValues | None, set[Definition[A]]]:
|
|
370
371
|
codeloc = override_codeloc or self.codeloc
|
|
371
372
|
existing_defs = self.live_definitions.get_definitions(atom)
|
|
372
373
|
mv = self.live_definitions.kill_and_add_definition(
|
|
@@ -446,7 +447,7 @@ class ReachingDefinitionsState:
|
|
|
446
447
|
self.codeloc_uses.update(self.get_definitions(atom))
|
|
447
448
|
self.live_definitions.add_use(atom, self.codeloc, expr=expr)
|
|
448
449
|
|
|
449
|
-
def add_use_by_def(self, definition: Definition, expr: Any | None = None) -> None:
|
|
450
|
+
def add_use_by_def(self, definition: Definition[A], expr: Any | None = None) -> None:
|
|
450
451
|
self.codeloc_uses.add(definition)
|
|
451
452
|
self.live_definitions.add_use_by_def(definition, self.codeloc, expr=expr)
|
|
452
453
|
|
|
@@ -455,7 +456,7 @@ class ReachingDefinitionsState:
|
|
|
455
456
|
self.add_tmp_use_by_defs(defs, expr=expr)
|
|
456
457
|
|
|
457
458
|
def add_tmp_use_by_defs(
|
|
458
|
-
self, defs: Iterable[Definition], expr: Any | None = None
|
|
459
|
+
self, defs: Iterable[Definition[A]], expr: Any | None = None
|
|
459
460
|
) -> None: # pylint:disable=unused-argument
|
|
460
461
|
for definition in defs:
|
|
461
462
|
self.codeloc_uses.add(definition)
|
|
@@ -466,7 +467,7 @@ class ReachingDefinitionsState:
|
|
|
466
467
|
defs = self.live_definitions.get_register_definitions(reg_offset, size)
|
|
467
468
|
self.add_register_use_by_defs(defs, expr=expr)
|
|
468
469
|
|
|
469
|
-
def add_register_use_by_defs(self, defs: Iterable[Definition], expr: Any | None = None) -> None:
|
|
470
|
+
def add_register_use_by_defs(self, defs: Iterable[Definition[A]], expr: Any | None = None) -> None:
|
|
470
471
|
for definition in defs:
|
|
471
472
|
self.codeloc_uses.add(definition)
|
|
472
473
|
self.live_definitions.add_register_use_by_def(definition, self.codeloc, expr=expr)
|
|
@@ -475,7 +476,7 @@ class ReachingDefinitionsState:
|
|
|
475
476
|
defs = self.live_definitions.get_stack_definitions(stack_offset, size)
|
|
476
477
|
self.add_stack_use_by_defs(defs, expr=expr)
|
|
477
478
|
|
|
478
|
-
def add_stack_use_by_defs(self, defs: Iterable[Definition], expr: Any | None = None):
|
|
479
|
+
def add_stack_use_by_defs(self, defs: Iterable[Definition[A]], expr: Any | None = None):
|
|
479
480
|
for definition in defs:
|
|
480
481
|
self.codeloc_uses.add(definition)
|
|
481
482
|
self.live_definitions.add_stack_use_by_def(definition, self.codeloc, expr=expr)
|
|
@@ -484,43 +485,39 @@ class ReachingDefinitionsState:
|
|
|
484
485
|
defs = self.live_definitions.get_heap_definitions(heap_offset, size)
|
|
485
486
|
self.add_heap_use_by_defs(defs, expr=expr)
|
|
486
487
|
|
|
487
|
-
def add_heap_use_by_defs(self, defs: Iterable[Definition], expr: Any | None = None):
|
|
488
|
+
def add_heap_use_by_defs(self, defs: Iterable[Definition[A]], expr: Any | None = None):
|
|
488
489
|
for definition in defs:
|
|
489
490
|
self.codeloc_uses.add(definition)
|
|
490
491
|
self.live_definitions.add_heap_use_by_def(definition, self.codeloc, expr=expr)
|
|
491
492
|
|
|
492
|
-
def add_memory_use_by_def(self, definition: Definition, expr: Any | None = None):
|
|
493
|
+
def add_memory_use_by_def(self, definition: Definition[A], expr: Any | None = None):
|
|
493
494
|
self.codeloc_uses.add(definition)
|
|
494
495
|
self.live_definitions.add_memory_use_by_def(definition, self.codeloc, expr=expr)
|
|
495
496
|
|
|
496
|
-
def add_memory_use_by_defs(self, defs: Iterable[Definition], expr: Any | None = None):
|
|
497
|
+
def add_memory_use_by_defs(self, defs: Iterable[Definition[A]], expr: Any | None = None):
|
|
497
498
|
for definition in defs:
|
|
498
499
|
self.codeloc_uses.add(definition)
|
|
499
500
|
self.live_definitions.add_memory_use_by_def(definition, self.codeloc, expr=expr)
|
|
500
501
|
|
|
501
|
-
def get_definitions(self, atom:
|
|
502
|
+
def get_definitions(self, atom: A | Definition[A] | Iterable[A] | Iterable[Definition[A]]) -> set[Definition[A]]:
|
|
502
503
|
return self.live_definitions.get_definitions(atom)
|
|
503
504
|
|
|
504
|
-
def get_values(self, spec:
|
|
505
|
+
def get_values(self, spec: A | Definition[A] | Iterable[A]) -> MultiValues | None:
|
|
505
506
|
return self.live_definitions.get_values(spec)
|
|
506
507
|
|
|
507
508
|
def get_one_value(
|
|
508
|
-
self, spec:
|
|
509
|
+
self, spec: A | Definition[A] | Iterable[A] | Iterable[Definition[A]], strip_annotations: bool = False
|
|
509
510
|
) -> claripy.ast.bv.BV | None:
|
|
510
511
|
return self.live_definitions.get_one_value(spec, strip_annotations=strip_annotations)
|
|
511
512
|
|
|
512
513
|
@overload
|
|
513
|
-
def get_concrete_value(
|
|
514
|
-
self, spec: Atom | Definition[Atom] | Iterable[Atom], cast_to: type[int] = ...
|
|
515
|
-
) -> int | None: ...
|
|
514
|
+
def get_concrete_value(self, spec: A | Definition[A] | Iterable[A], cast_to: type[int] = ...) -> int | None: ...
|
|
516
515
|
|
|
517
516
|
@overload
|
|
518
|
-
def get_concrete_value(
|
|
519
|
-
self, spec: Atom | Definition[Atom] | Iterable[Atom], cast_to: type[bytes] = ...
|
|
520
|
-
) -> bytes | None: ...
|
|
517
|
+
def get_concrete_value(self, spec: A | Definition[A] | Iterable[A], cast_to: type[bytes] = ...) -> bytes | None: ...
|
|
521
518
|
|
|
522
519
|
def get_concrete_value(
|
|
523
|
-
self, spec:
|
|
520
|
+
self, spec: A | Definition[A] | Iterable[A], cast_to: type[int] | type[bytes] = int
|
|
524
521
|
) -> int | bytes | None:
|
|
525
522
|
return self.live_definitions.get_concrete_value(spec, cast_to)
|
|
526
523
|
|
|
@@ -593,7 +590,7 @@ class ReachingDefinitionsState:
|
|
|
593
590
|
@overload
|
|
594
591
|
def deref(
|
|
595
592
|
self,
|
|
596
|
-
pointer: MultiValues |
|
|
593
|
+
pointer: MultiValues | A | Definition | Iterable[A] | Iterable[Definition[A]],
|
|
597
594
|
size: int | DerefSize,
|
|
598
595
|
endness: str = ...,
|
|
599
596
|
) -> set[MemoryLocation]: ...
|
|
@@ -602,10 +599,10 @@ class ReachingDefinitionsState:
|
|
|
602
599
|
self,
|
|
603
600
|
pointer: (
|
|
604
601
|
MultiValues
|
|
605
|
-
|
|
|
602
|
+
| A
|
|
606
603
|
| Definition
|
|
607
|
-
| Iterable[
|
|
608
|
-
| Iterable[Definition]
|
|
604
|
+
| Iterable[A]
|
|
605
|
+
| Iterable[Definition[A]]
|
|
609
606
|
| int
|
|
610
607
|
| claripy.ast.BV
|
|
611
608
|
| HeapAddress
|
|
@@ -563,15 +563,6 @@ class SimEngineVRVEX(
|
|
|
563
563
|
return RichR(self.state.top(expr_0.data.size()))
|
|
564
564
|
return RichR(self.state.top(expr_0.data.size()))
|
|
565
565
|
|
|
566
|
-
def _handle_Ctz(self, expr):
|
|
567
|
-
arg0 = expr.args[0]
|
|
568
|
-
expr_0 = self._expr(arg0)
|
|
569
|
-
if expr_0 is None:
|
|
570
|
-
return None
|
|
571
|
-
if self.state.is_top(expr_0.data):
|
|
572
|
-
return RichR(self.state.top(expr_0.data.size()))
|
|
573
|
-
return RichR(self.state.top(expr_0.data.size()))
|
|
574
|
-
|
|
575
566
|
_handle_CmpEQ_v = _handle_Cmp_v
|
|
576
567
|
_handle_CmpNE_v = _handle_Cmp_v
|
|
577
568
|
_handle_CmpLE_v = _handle_Cmp_v
|
angr/analyses/vfg.py
CHANGED
|
@@ -1303,7 +1303,7 @@ class VFG(ForwardAnalysis[SimState, VFGNode, VFGJob, BlockID], Analysis): # pyl
|
|
|
1303
1303
|
# TODO: the following code is totally untested other than X86 and AMD64. Don't freak out if you find bugs :)
|
|
1304
1304
|
# TODO: Test it
|
|
1305
1305
|
|
|
1306
|
-
ret_bvv =
|
|
1306
|
+
ret_bvv = claripy.BVV(ret_addr, self.project.arch.bits)
|
|
1307
1307
|
|
|
1308
1308
|
if self.project.arch.name in ("X86", "AMD64"):
|
|
1309
1309
|
state.stack_push(ret_bvv)
|
|
@@ -1524,13 +1524,13 @@ class VFG(ForwardAnalysis[SimState, VFGNode, VFGJob, BlockID], Analysis): # pyl
|
|
|
1524
1524
|
successor_state.registers.store(arch.sp_offset, reg_sp_expr)
|
|
1525
1525
|
|
|
1526
1526
|
# Clear the return value with a TOP
|
|
1527
|
-
top_si =
|
|
1527
|
+
top_si = claripy.TSI(arch.bits)
|
|
1528
1528
|
successor_state.registers.store(arch.ret_offset, top_si)
|
|
1529
1529
|
|
|
1530
1530
|
if job.call_skipped:
|
|
1531
1531
|
# TODO: Make sure the return values make sense
|
|
1532
1532
|
# if self.project.arch.name == "X86":
|
|
1533
|
-
# successor_state.regs.eax =
|
|
1533
|
+
# successor_state.regs.eax = claripy.BVS(
|
|
1534
1534
|
# "ret_val", 32, min=0, max=0xFFFFFFFF, stride=1
|
|
1535
1535
|
# )
|
|
1536
1536
|
|
|
@@ -1564,7 +1564,7 @@ class VFG(ForwardAnalysis[SimState, VFGNode, VFGJob, BlockID], Analysis): # pyl
|
|
|
1564
1564
|
reg_sp_si = self._create_stack_region(successor_state, successor_addr)
|
|
1565
1565
|
|
|
1566
1566
|
# Save the new sp register
|
|
1567
|
-
new_reg_sp_expr =
|
|
1567
|
+
new_reg_sp_expr = claripy.ValueSet(successor_state.arch.bits, "global", 0, reg_sp_si)
|
|
1568
1568
|
successor_state.regs.sp = new_reg_sp_expr
|
|
1569
1569
|
|
|
1570
1570
|
elif successor.history.jumpkind == "Ijk_Ret":
|
angr/calling_conventions.py
CHANGED
|
@@ -413,7 +413,7 @@ class SimComboArg(SimFunctionArgument):
|
|
|
413
413
|
vals = []
|
|
414
414
|
for loc in reversed(self.locations):
|
|
415
415
|
vals.append(loc.get_value(state, **kwargs))
|
|
416
|
-
return self.check_value_get(
|
|
416
|
+
return self.check_value_get(claripy.Concat(*vals))
|
|
417
417
|
|
|
418
418
|
|
|
419
419
|
class SimStructArg(SimFunctionArgument):
|
|
@@ -1031,7 +1031,7 @@ class SimCC:
|
|
|
1031
1031
|
if isinstance(ty, SimTypeFloat):
|
|
1032
1032
|
return SimCC._standardize_value(float(arg), ty, state, alloc)
|
|
1033
1033
|
|
|
1034
|
-
val =
|
|
1034
|
+
val = claripy.BVV(arg, ty.size)
|
|
1035
1035
|
return val
|
|
1036
1036
|
|
|
1037
1037
|
elif isinstance(arg, float):
|
|
@@ -2300,6 +2300,8 @@ def default_cc( # pylint:disable=unused-argument
|
|
|
2300
2300
|
if alias not in cc_map or platform not in cc_map[alias]:
|
|
2301
2301
|
if default is not ...:
|
|
2302
2302
|
return default
|
|
2303
|
+
else:
|
|
2304
|
+
return None
|
|
2303
2305
|
return cc_map[alias][platform]
|
|
2304
2306
|
|
|
2305
2307
|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import claripy
|
|
2
|
+
|
|
1
3
|
from . import SimConcretizationStrategy
|
|
2
4
|
|
|
3
5
|
|
|
@@ -24,7 +26,7 @@ class SimConcretizationStrategyAnyNamed(SimConcretizationStrategy):
|
|
|
24
26
|
target = self._any(memory, addr, extra_constraints=child_constraints, **kwargs)
|
|
25
27
|
# Create new BVS
|
|
26
28
|
old_name = " ".join(repr(addr)[:-1].split(" ")[1:])
|
|
27
|
-
new_BVS =
|
|
29
|
+
new_BVS = claripy.BVS(f"[{old_name}]", memory.state.arch.bits, explicit_name=True)
|
|
28
30
|
memory.store(target, new_BVS, endness=memory.state.arch.memory_endness)
|
|
29
31
|
# Enforce the address
|
|
30
32
|
memory.state.solver.add(addr == target)
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
from itertools import groupby
|
|
2
2
|
|
|
3
|
+
import claripy
|
|
4
|
+
|
|
3
5
|
from . import SimConcretizationStrategy
|
|
4
6
|
|
|
5
7
|
|
|
@@ -40,10 +42,10 @@ class SimConcretizationStrategyControlledData(SimConcretizationStrategy):
|
|
|
40
42
|
|
|
41
43
|
# create constraints from intervals
|
|
42
44
|
for base, length in intervals:
|
|
43
|
-
constraints.append(
|
|
45
|
+
constraints.append(claripy.And(addr >= base, addr < base + length))
|
|
44
46
|
|
|
45
47
|
# try to get solutions for controlled memory
|
|
46
|
-
ored_constraints =
|
|
48
|
+
ored_constraints = claripy.Or(*constraints)
|
|
47
49
|
child_constraints = (ored_constraints,)
|
|
48
50
|
extra_constraints = kwargs.pop("extra_constraints", None)
|
|
49
51
|
if extra_constraints is not None:
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import claripy
|
|
2
|
+
|
|
1
3
|
from . import SimConcretizationStrategy
|
|
2
4
|
|
|
3
5
|
|
|
@@ -21,4 +23,4 @@ class SimConcretizationStrategySignedAdd(SimConcretizationStrategy):
|
|
|
21
23
|
new_arg = (1 << addr.args[1].size()) - memory.state.solver.eval(addr.args[1])
|
|
22
24
|
if new_arg < self._substraction_limit:
|
|
23
25
|
addr.op = "__sub__"
|
|
24
|
-
addr.args = (addr.args[0],
|
|
26
|
+
addr.args = (addr.args[0], claripy.BVV(new_arg, addr.args[1].size()))
|
angr/engines/concrete.py
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
import threading
|
|
3
3
|
|
|
4
|
+
import claripy
|
|
5
|
+
|
|
4
6
|
from angr.errors import AngrError
|
|
5
7
|
from .engine import SuccessorsMixin
|
|
6
8
|
from ..errors import SimConcreteRegisterError
|
|
@@ -58,7 +60,7 @@ class SimEngineConcrete(SuccessorsMixin):
|
|
|
58
60
|
|
|
59
61
|
successors.engine = "SimEngineConcrete"
|
|
60
62
|
successors.sort = "SimEngineConcrete"
|
|
61
|
-
successors.add_successor(new_state, new_state.ip,
|
|
63
|
+
successors.add_successor(new_state, new_state.ip, claripy.true, new_state.unicorn.jumpkind)
|
|
62
64
|
successors.description = "Concrete Successors"
|
|
63
65
|
successors.processed = True
|
|
64
66
|
|
angr/engines/pcode/behavior.py
CHANGED
|
@@ -868,6 +868,8 @@ class OpBehaviorSubpiece(OpBehavior):
|
|
|
868
868
|
def evaluate_binary(self, size_out: int, size_in: int, in1: BV, in2: BV) -> BV:
|
|
869
869
|
if in2.size() < in1.size():
|
|
870
870
|
in2 = in2.sign_extend(in1.size() - in2.size())
|
|
871
|
+
if in1.size() < in2.size():
|
|
872
|
+
in1 = in1.sign_extend(in2.size() - in1.size())
|
|
871
873
|
return (in1 >> (in2 * 8)) & (2 ** (size_out * 8) - 1)
|
|
872
874
|
|
|
873
875
|
|
angr/engines/pcode/cc.py
CHANGED
|
@@ -10,6 +10,7 @@ from ...calling_conventions import (
|
|
|
10
10
|
register_default_cc,
|
|
11
11
|
SimCCUnknown,
|
|
12
12
|
default_cc,
|
|
13
|
+
SimCCO32,
|
|
13
14
|
)
|
|
14
15
|
|
|
15
16
|
|
|
@@ -107,6 +108,7 @@ def register_pcode_arch_default_cc(arch: ArchPcode):
|
|
|
107
108
|
"PowerPC:BE:32:e200": SimCCPowerPC,
|
|
108
109
|
"PowerPC:BE:32:MPC8270": SimCCPowerPC,
|
|
109
110
|
"Xtensa:LE:32:default": SimCCXtensa,
|
|
111
|
+
"MIPS:LE:32:default": SimCCO32,
|
|
110
112
|
}
|
|
111
113
|
if arch.name in manual_cc_mapping:
|
|
112
114
|
# first attempt: manually specified mappings
|
angr/engines/pcode/emulate.py
CHANGED
|
@@ -187,7 +187,7 @@ class PcodeEmulatorMixin(SimEngineBase):
|
|
|
187
187
|
elif space.name == "unique":
|
|
188
188
|
self._pcode_tmps[varnode.offset] = value
|
|
189
189
|
|
|
190
|
-
elif space.name in ("ram", "mem"):
|
|
190
|
+
elif space.name.lower() in ("ram", "mem"):
|
|
191
191
|
l.debug("Storing %s to offset %s", value, varnode.offset)
|
|
192
192
|
self.state.memory.store(varnode.offset, value, endness=self.project.arch.memory_endness)
|
|
193
193
|
|
|
@@ -225,7 +225,7 @@ class PcodeEmulatorMixin(SimEngineBase):
|
|
|
225
225
|
self._pcode_tmps[varnode.offset] = claripy.BVV(0, size * 8)
|
|
226
226
|
return self._pcode_tmps[varnode.offset]
|
|
227
227
|
|
|
228
|
-
elif space_name in ("ram", "mem"):
|
|
228
|
+
elif space_name.lower() in ("ram", "mem"):
|
|
229
229
|
val = self.state.memory.load(varnode.offset, endness=self.project.arch.memory_endness, size=size)
|
|
230
230
|
l.debug("Loaded %s from offset %s", val, varnode.offset)
|
|
231
231
|
return val
|
|
@@ -285,7 +285,7 @@ class PcodeEmulatorMixin(SimEngineBase):
|
|
|
285
285
|
space = self._current_op.inputs[0].getSpaceFromConst()
|
|
286
286
|
offset = self._get_value(self._current_op.inputs[1])
|
|
287
287
|
out = self._current_op.output
|
|
288
|
-
if space.name in ("ram", "mem"):
|
|
288
|
+
if space.name.lower() in ("ram", "mem"):
|
|
289
289
|
res = self.state.memory.load(offset, out.size, endness=self.project.arch.memory_endness)
|
|
290
290
|
elif space.name in "register":
|
|
291
291
|
res = self.state.registers.load(offset, size=out.size, endness=self.project.arch.register_endness)
|
|
@@ -304,7 +304,7 @@ class PcodeEmulatorMixin(SimEngineBase):
|
|
|
304
304
|
offset = self._get_value(self._current_op.inputs[1])
|
|
305
305
|
data = self._get_value(self._current_op.inputs[2])
|
|
306
306
|
l.debug("Storing %s at offset %s", data, offset)
|
|
307
|
-
if space.name in ("ram", "mem"):
|
|
307
|
+
if space.name.lower() in ("ram", "mem"):
|
|
308
308
|
self.state.memory.store(offset, data, endness=self.project.arch.memory_endness)
|
|
309
309
|
elif space.name == "register":
|
|
310
310
|
self.state.registers.store(offset, data, endness=self.project.arch.register_endness)
|
angr/engines/pcode/engine.py
CHANGED
|
@@ -224,7 +224,7 @@ class HeavyPcodeMixin(
|
|
|
224
224
|
"return value in Call-less mode.",
|
|
225
225
|
exit_state.arch.name,
|
|
226
226
|
)
|
|
227
|
-
exit_state.scratch.target =
|
|
227
|
+
exit_state.scratch.target = claripy.BVV(
|
|
228
228
|
successors.addr + self.state.scratch.irsb.size, exit_state.arch.bits
|
|
229
229
|
)
|
|
230
230
|
exit_state.history.jumpkind = "Ijk_Ret"
|
|
@@ -238,12 +238,8 @@ class HeavyPcodeMixin(
|
|
|
238
238
|
l.debug("%s adding postcall exit.", self)
|
|
239
239
|
|
|
240
240
|
ret_state = exit_state.copy()
|
|
241
|
-
guard =
|
|
242
|
-
|
|
243
|
-
if o.TRUE_RET_EMULATION_GUARD in self.state.options
|
|
244
|
-
else ret_state.solver.false
|
|
245
|
-
)
|
|
246
|
-
ret_target = ret_state.solver.BVV(successors.addr + self.state.scratch.irsb.size, ret_state.arch.bits)
|
|
241
|
+
guard = claripy.true if o.TRUE_RET_EMULATION_GUARD in self.state.options else claripy.false
|
|
242
|
+
ret_target = claripy.BVV(successors.addr + self.state.scratch.irsb.size, ret_state.arch.bits)
|
|
247
243
|
if ret_state.arch.call_pushes_ret and not exit_jumpkind.startswith("Ijk_Sys"):
|
|
248
244
|
ret_state.regs.sp = ret_state.regs.sp + ret_state.arch.bytes
|
|
249
245
|
successors.add_successor(
|
angr/engines/soot/engine.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
|
|
3
|
+
import claripy
|
|
3
4
|
from archinfo.arch_soot import (
|
|
4
5
|
ArchSoot,
|
|
5
6
|
SootAddressDescriptor,
|
|
@@ -134,7 +135,7 @@ class SootMixin(SuccessorsMixin, ProcedureMixin):
|
|
|
134
135
|
next_addr = self._get_next_linear_instruction(state, stmt_idx)
|
|
135
136
|
l.debug("Advancing execution linearly to %s", next_addr)
|
|
136
137
|
if next_addr is not None:
|
|
137
|
-
successors.add_successor(state.copy(), next_addr,
|
|
138
|
+
successors.add_successor(state.copy(), next_addr, claripy.true, "Ijk_Boring")
|
|
138
139
|
|
|
139
140
|
def _handle_soot_stmt(self, state, successors, stmt_idx, stmt):
|
|
140
141
|
# execute statement
|
|
@@ -172,7 +173,7 @@ class SootMixin(SuccessorsMixin, ProcedureMixin):
|
|
|
172
173
|
# add invoke state as the successor and terminate execution
|
|
173
174
|
# prematurely, since Soot does not guarantee that an invoke stmt
|
|
174
175
|
# terminates a block
|
|
175
|
-
successors.add_successor(invoke_state, addr,
|
|
176
|
+
successors.add_successor(invoke_state, addr, claripy.true, "Ijk_Call")
|
|
176
177
|
return True
|
|
177
178
|
|
|
178
179
|
# add jmp exit
|
|
@@ -198,7 +199,7 @@ class SootMixin(SuccessorsMixin, ProcedureMixin):
|
|
|
198
199
|
def _add_return_exit(cls, state, successors, return_val=None):
|
|
199
200
|
ret_state = state.copy()
|
|
200
201
|
cls.prepare_return_state(ret_state, return_val)
|
|
201
|
-
successors.add_successor(ret_state, state.callstack.ret_addr,
|
|
202
|
+
successors.add_successor(ret_state, state.callstack.ret_addr, claripy.true, "Ijk_Ret")
|
|
202
203
|
successors.processed = True
|
|
203
204
|
|
|
204
205
|
def _get_sim_procedure(self, addr):
|
|
@@ -321,9 +322,9 @@ class SootMixin(SuccessorsMixin, ProcedureMixin):
|
|
|
321
322
|
if type(statement) is SimSootStmt_Return:
|
|
322
323
|
exit_code = statement.return_value
|
|
323
324
|
# TODO symbolic exit code?
|
|
324
|
-
exit_code =
|
|
325
|
+
exit_code = claripy.BVV(exit_code, state.arch.bits)
|
|
325
326
|
state.history.add_event("terminate", exit_code=exit_code)
|
|
326
|
-
successors.add_successor(state, state.regs.ip,
|
|
327
|
+
successors.add_successor(state, state.regs.ip, claripy.true, "Ijk_Exit")
|
|
327
328
|
successors.processed = True
|
|
328
329
|
raise BlockTerminationNotice()
|
|
329
330
|
|
|
@@ -345,7 +346,7 @@ class SootMixin(SuccessorsMixin, ProcedureMixin):
|
|
|
345
346
|
|
|
346
347
|
# set successor flags
|
|
347
348
|
ret_state.regs._ip = ret_state.callstack.ret_addr
|
|
348
|
-
ret_state.scratch.guard =
|
|
349
|
+
ret_state.scratch.guard = claripy.true
|
|
349
350
|
ret_state.history.jumpkind = "Ijk_Ret"
|
|
350
351
|
|
|
351
352
|
# if available, lookup the return value in native memory
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import claripy
|
|
1
2
|
from archinfo.arch_soot import SootClassDescriptor, SootNullConstant
|
|
2
3
|
from claripy import FSORT_DOUBLE, FSORT_FLOAT
|
|
3
4
|
|
|
@@ -7,28 +8,28 @@ from .base import SimSootExpr
|
|
|
7
8
|
|
|
8
9
|
class SimSootExpr_IntConstant(SimSootExpr):
|
|
9
10
|
def _execute(self):
|
|
10
|
-
self.expr =
|
|
11
|
+
self.expr = claripy.BVV(self.expr.value, 32)
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
class SimSootExpr_LongConstant(SimSootExpr):
|
|
14
15
|
def _execute(self):
|
|
15
|
-
self.expr =
|
|
16
|
+
self.expr = claripy.BVV(self.expr.value, 64)
|
|
16
17
|
|
|
17
18
|
|
|
18
19
|
class SimSootExpr_FloatConstant(SimSootExpr):
|
|
19
20
|
def _execute(self):
|
|
20
|
-
self.expr =
|
|
21
|
+
self.expr = claripy.FPV(self.expr.value, FSORT_FLOAT)
|
|
21
22
|
|
|
22
23
|
|
|
23
24
|
class SimSootExpr_DoubleConstant(SimSootExpr):
|
|
24
25
|
def _execute(self):
|
|
25
|
-
self.expr =
|
|
26
|
+
self.expr = claripy.FPV(self.expr.value, FSORT_DOUBLE)
|
|
26
27
|
|
|
27
28
|
|
|
28
29
|
class SimSootExpr_StringConstant(SimSootExpr):
|
|
29
30
|
def _execute(self):
|
|
30
31
|
# strip away quotes introduced by soot
|
|
31
|
-
str_val =
|
|
32
|
+
str_val = claripy.StringV(self.expr.value.strip('"'))
|
|
32
33
|
str_ref = SimSootValue_StringRef(self.state.memory.get_new_uuid())
|
|
33
34
|
self.state.memory.store(str_ref, str_val)
|
|
34
35
|
self.expr = str_ref
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
|
|
3
|
+
import claripy
|
|
4
|
+
|
|
3
5
|
from ..values import SimSootValue_ArrayBaseRef
|
|
4
6
|
from .base import SimSootExpr
|
|
5
7
|
|
|
@@ -27,7 +29,7 @@ class SimSootExpr_NewArray(SimSootExpr):
|
|
|
27
29
|
@staticmethod
|
|
28
30
|
def _bound_array_size(state, array_size):
|
|
29
31
|
# check if array size can exceed MAX_ARRAY_SIZE
|
|
30
|
-
max_array_size =
|
|
32
|
+
max_array_size = claripy.BVV(state.javavm_memory.max_array_size, 32)
|
|
31
33
|
size_stays_below_maximum = state.solver.eval_upto(max_array_size.SGE(array_size), 2)
|
|
32
34
|
|
|
33
35
|
# overwrite size, if it *always* exceeds the maximum
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
|
|
3
|
+
import claripy
|
|
4
|
+
|
|
3
5
|
from .base import SimSootExpr
|
|
4
6
|
from .newArray import SimSootExpr_NewArray
|
|
5
7
|
from ..values import SimSootValue_ArrayBaseRef
|
|
@@ -39,7 +41,7 @@ class SimSootExpr_NewMultiArray(SimSootExpr):
|
|
|
39
41
|
@staticmethod
|
|
40
42
|
def _bound_multi_array_size(state, multi_array_size):
|
|
41
43
|
# check if array size can exceed MAX_ARRAY_SIZE
|
|
42
|
-
max_multi_array_size =
|
|
44
|
+
max_multi_array_size = claripy.BVV(state.javavm_memory.max_array_size, 32)
|
|
43
45
|
size_stays_below_maximum = state.solver.eval_upto(max_multi_array_size.SGE(multi_array_size), 2)
|
|
44
46
|
|
|
45
47
|
# overwrite size, if it *always* exceeds the maximum
|