SeUniVr / EtherSolve

Source code of EtherSolve: static analysis of Ethereum bytecode
MIT License
67 stars 15 forks source link

Erroneous creation of edges that don't map to nodes #9

Open biddls opened 8 months ago

biddls commented 8 months ago

Hi,

I think I've found a bug

Given this bytecode, from Mainnet 0x0000000000007f150bd6f54c40a34d7c3d5e9f56.txt

Generates the accompanying Json file: 0x0000000000007f150bd6f54c40a34d7c3d5e9f56.json using this script: CFG_generatio.py

The incorrect links point to nodes:

8404
8467
5822
8568
6130
6137
8667
7023
7112
8717
7459
8774
7970

For example:

      {
        "from": 715,
        "to": [
          8404
        ]
      },

There is no 8404 But there is for 715:

      {
        "offset": 715,
        "length": 15,
        "type": "dispatcher",
        "stackBalance": 3,
        "bytecodeHex": "5b506102df6102da3660046120d456",
        "parsedOpcodes": "715: JUMPDEST\n716: POP\n717: PUSH2 0x02df\n720: PUSH2 0x02da\n723: CALLDATASIZE\n724: PUSH1 0x04\n726: PUSH2 0x20d4\n729: JUMP"
      },

I have re-run the EVM file and gotten the same result

I can fix it in my script by just not including the edges that point to erroneous nodes, but thought I'd let you know.

Hope this helps