Skip to content

Commit 975b4a8

Browse files
committed
args_render_layer example: Fix python errors
1 parent be59016 commit 975b4a8

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

python/examples/args_render_layer.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def get_param_sites(mlil: MediumLevelILFunction) -> Mapping[LowLevelILInstructio
4545
:param mlil: MLIL function to search
4646
:return: Map of param sites as described above
4747
"""
48-
call_sites = {}
48+
call_sites: dict[MediumLevelILInstruction, List[Tuple[int, LowLevelILInstruction]]] = {}
4949
mlil = mlil.ssa_form
5050

5151
# As a function to handle call and tailcall identically
@@ -54,7 +54,7 @@ def collect_call_params(call_site, dest, params):
5454
for i, param in enumerate(params):
5555
llil = param.llil
5656
if llil is not None:
57-
def_sites.append((param, llil))
57+
def_sites.append((i, llil))
5858
continue
5959

6060
match param:
@@ -73,10 +73,11 @@ def collect_call_params(call_site, dest, params):
7373
case MediumLevelILConstBase():
7474
# This is wrong, but it works (sometimes)
7575
# Oh god, have I just quoted php.net
76-
def_site_idx = mlil.llil.get_instruction_start(param.address)
77-
if def_site_idx is not None:
78-
def_sites.append((i, mlil.llil[def_site_idx].ssa_form))
79-
continue
76+
if mlil.llil is not None:
77+
def_site_idx = mlil.llil.get_instruction_start(param.address)
78+
if def_site_idx is not None:
79+
def_sites.append((i, mlil.llil[def_site_idx].ssa_form))
80+
continue
8081

8182
if len(def_sites) == 0:
8283
log_debug(f"Could not find def site for param {i} in call at {call_site.address:#x}")

0 commit comments

Comments
 (0)