Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check *put instructions in pickle scan #54

Merged
merged 1 commit into from
Nov 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions modelscan/tools/picklescanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,20 @@ def _list_globals(
op_name = op[0].name
op_value: str = op[1]

if op_name == "MEMOIZE" and n > 0:
if op_name in ["MEMOIZE", "PUT", "BINPUT", "LONG_BINPUT"] and n > 0:
memo[len(memo)] = ops[n - 1][1]

if op_name in ["GLOBAL", "INST"]:
globals.add(tuple(op_value.split(" ", 1)))
elif op_name == "STACK_GLOBAL":
values: List[str] = []
for offset in range(1, n):
if ops[n - offset][0].name == "MEMOIZE":
if ops[n - offset][0].name in [
"MEMOIZE",
"PUT",
"BINPUT",
"LONG_BINPUT",
]:
continue
if ops[n - offset][0].name in ["GET", "BINGET", "LONG_BINGET"]:
values.append(memo[int(ops[n - offset][1])])
Expand Down
Loading