Bug Report
File: python/languagerepresentation.py
Line: 621 (get_block_lines method of LanguageRepresentationFunction)
Description
There is a variable usage bug in the get_block_lines method of the LanguageRepresentationFunction class.
At line 621, the code attempts to reference instr.function, but the variable instr is not defined within the scope of this method.
Given the method signature and context, it should use block instead of instr to retrieve the function instance.
Problematic Code (around line 621)
for i in range(0, count.value):
addr = lines[i].addr
if lines[i].instrIndex != 0xffffffffffffffff:
il_instr = instr.function[lines[i].instrIndex] # <-- 'instr' is not defined here
else:
il_instr = None
...
Expected Code
The correct reference should be block.function instead of instr.function, as shown below:
for i in range(0, count.value):
addr = lines[i].addr
if lines[i].instrIndex != 0xffffffffffffffff:
il_instr = block.function[lines[i].instrIndex]
else:
il_instr = None
...
How to Reproduce
- Call
get_block_lines for any HighLevelILBasicBlock.
- Observe a
NameError similar to:
NameError: name 'instr' is not defined
Suggested Fix
Replace all instances of instr.function with block.function within the get_block_lines method to ensure the correct variable is referenced.
Additional Context
If possible, I can submit a pull request to address this issue.
Bug Report
File:
python/languagerepresentation.pyLine: 621 (
get_block_linesmethod ofLanguageRepresentationFunction)Description
There is a variable usage bug in the
get_block_linesmethod of theLanguageRepresentationFunctionclass.At line 621, the code attempts to reference
instr.function, but the variableinstris not defined within the scope of this method.Given the method signature and context, it should use
blockinstead ofinstrto retrieve the function instance.Problematic Code (around line 621)
Expected Code
The correct reference should be
block.functioninstead ofinstr.function, as shown below:How to Reproduce
get_block_linesfor anyHighLevelILBasicBlock.NameErrorsimilar to:Suggested Fix
Replace all instances of
instr.functionwithblock.functionwithin theget_block_linesmethod to ensure the correct variable is referenced.Additional Context
If possible, I can submit a pull request to address this issue.