JUMPDEST instructions missing in CFG
See original GitHub issueDescription
- Not sure if it’s a bug or a feature, but the JUMPDEST at the start of jump targets isn’t shown in the CFG. See e.g. the JUMPI to offset 159, and the target node starts at offset 160.
- Function names used to be shown in the CFG at the start of each function, those are gone as well.
How to Reproduce
Using Mythril 0.18.11 Pypi:
$ myth -g cfg.html -ia 0x35efabf6e2d970a3bc3fa1de991ec63987c127bc
Expected behavior
Include the JUMPDEST instruction at the start of the node or the function name if it’s the start of a function.
Environment
- Mythril version: 0.18.11 Pypi
- Python version: 3.6.3
- OS and Version: Mac OS High Sierra
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Why jumping into an instruction even if containing a ...
We define this as any position in the code occupied by a JUMPDEST instruction. All such positions must be on valid instruction boundaries, ......
Read more >Mythril Documentation - Read the Docs
This module contains a representation class for EVM instructions and transitions between them. class mythril.laser.ethereum.instructions.
Read more >Understand EVM bytecode – Part 2 - Trustlook blog
This is a special opcode which only marks an address that can be jumped to. It does not seem to play an important...
Read more >EtherSolve: Computing an Accurate Control-Flow Graph from ...
This paper presents a novel static analysis algorithm based on the symbolic execution of the Ethereum operand stack that allows us to resolve ......
Read more >Error in compiling/installing RealTime Kernel on Ubuntu 20.04 ...
I followed this guide https://unix.stackexchange.com/a/294116/419660. sudo gedit .config. Add a # in front of the lines ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
What about something like the following:
I think this will be simpler, and more easy to directly understand the meaning
@JoranHonig Thanks for clarifying. After having spent just a couple of hours with the LASER core routines it’s still quite a bit of black magic to me. As for the pc index of the JUMPDEST, instead of manipulating the
@instruction
decorator and having to deal with all instructions, we could simply decrement the index in theJUMP
andJUMPI
mutator functions. In these functions there’s already logic handlingJUMPDEST
instructions, so it wouldn’t add any bloat to the functions and we could simply set the index, e.g. injumpi_
like such (ininstructions.py:842
):While that still doesn’t look too clean as the -1 isn’t self-explanatory, I think it’s more elegant than handling the case in the instruction decorator. If we were to do the latter, we’d have to get the jump destination address there again and set the pc accordingly. But then we would’ve repeated the same logic again, which would make it harder to maintain and refactor. A comment at the pc change in the above code sample would of course also help make things clearer. 😄
Thoughts?