ethdasm icon indicating copy to clipboard operation
ethdasm copied to clipboard

Bug with functions that pass through stack values

Open meyer9 opened this issue 8 years ago • 0 comments

Bytecode to reproduce:

600160025b5b01

Disassembled bytecode:

; Procedure 0x0
[     0x0] | PUSH1                | [1]
[     0x2] | PUSH1                | [2]

; Procedure 0x4
[     0x4] | JUMPDEST             | None

; Procedure 0x5
[     0x5] | JUMPDEST             | None
[     0x6] | ADD                  | None

Error:

Traceback (most recent call last):
  File "ethdasm.py", line 18, in <module>
    blocks = contract.parse()
  File "/Users/jmeyer2k/development/ethdasm/ethdasm/contract.py", line 328, in parse
    self.__add_final_functions()
  File "/Users/jmeyer2k/development/ethdasm/ethdasm/contract.py", line 272, in __add_final_functions
    arguments.append(block.return_vals[i])
IndexError: list index out of range

The problem here is that the ending function for the second block actually requires arguments to be passed through. It might need to add arguments to the previous function if the next function requires more values than the block puts on the stack.

Also, a problem arises when now we need to update the previous block to take in a certain number of parameters.

This bug will require some serious thinking.

meyer9 avatar Oct 08 '17 21:10 meyer9