Skip to content

Bug with functions that pass through stack values #4

@meyer9

Description

@meyer9

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions