mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Python: CG trace: Handle LOAD_DEREF
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
def func(func_arg):
|
||||
print("func")
|
||||
|
||||
def func2():
|
||||
print("func2")
|
||||
return func_arg()
|
||||
|
||||
func2()
|
||||
|
||||
|
||||
def nop():
|
||||
print("nop")
|
||||
pass
|
||||
|
||||
|
||||
func(nop)
|
||||
|
||||
|
||||
"""
|
||||
Needs handling of LOAD_DEREF. Disassembled bytecode looks like:
|
||||
|
||||
6 8 LOAD_DEREF 0 (func_arg)
|
||||
10 CALL_FUNCTION 0
|
||||
12 RETURN_VALUE
|
||||
"""
|
||||
@@ -143,7 +143,7 @@ def expr_from_instruction(instructions: List[Instruction], index: int) -> Byteco
|
||||
|
||||
LOGGER.debug(f"expr_from_instruction: {inst} {index=}")
|
||||
|
||||
if inst.opname in ["LOAD_GLOBAL", "LOAD_FAST", "LOAD_NAME"]:
|
||||
if inst.opname in ["LOAD_GLOBAL", "LOAD_FAST", "LOAD_NAME", "LOAD_DEREF"]:
|
||||
return BytecodeVariableName(inst.argval)
|
||||
|
||||
elif inst.opname in ["LOAD_CONST"]:
|
||||
|
||||
Reference in New Issue
Block a user