crytic / tealer

Static Analyzer for Teal
GNU Affero General Public License v3.0
62 stars 14 forks source link

"Not found txnas ApplicationArgs" #25

Closed montyly closed 2 years ago

montyly commented 2 years ago

https://github.com/crytic/tealer/pull/12#issuecomment-993673839

feliam commented 2 years ago

I get "Not found txnas ApplicationArgs" when trying to run against teal v5 of mine with this merged code.

@pbennett at the time we are failing at reproducing this. Could you give us more details about it. Can you share part of the contract with the issue?

pbennett commented 2 years ago
main_l21:
load 4
txnas ApplicationArgs
callsub sub6

Loading an index from scratch space and pushing the Txn application args[index] to stack.

pbennett commented 2 years ago

Any updates? @feliam are you still not reproducing this? The txnas call with ApplicationArgs is pretty explicitly supported in TEALv5 and tealer's error is pretty clear.

feliam commented 2 years ago

I can not get your exact error. Rather it only fails when trying to construct the CFG...

Analyze bug.teal
CFG exported: cfg.dot
Traceback (most recent call last):
  File "tealer/venv/bin/tealer", line 33, in <module>
    sys.exit(load_entry_point('tealer', 'console_scripts', 'tealer')())
  File "tealer/tealer/__main__.py", line 70, in main
    teal.render_cfg(Path("cfg.dot"))
  File "tealer/tealer/teal/teal.py", line 51, in render_cfg
    dot_output += Teal.render_bb(idx, bb)
  File "tealer/tealer/teal/teal.py", line 41, in render_bb
    exit_loc = bb.exit_instr.line
  File "tealer/tealer/teal/basic_blocks.py", line 25, in exit_instr
    return self._instructions[-1]
IndexError: list index out of range
pbennett commented 2 years ago

Interesting - I was running w/ python3 tealer xxx and get that error - even w/ virtualenv If I run the python3 setup.py installer and then run w/ tealer xxx.teal - it seems to work. ?

pbennett commented 2 years ago

I get the error when running tealer via python command but if I use the installer and then run tealer, it works. You can close the issue.

feliam commented 2 years ago

Thanks!