Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/pip/werkzeug-3.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
seanpmorgan authored Nov 6, 2023
2 parents 1e1a865 + d9c972c commit 379d920
Showing 1 changed file with 7 additions and 2 deletions.
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

0 comments on commit 379d920

Please sign in to comment.