Closed p0n1 closed 6 years ago
could forget to store retval to memory in several places.
Return values are not handled well currently because of the way calls are implemented. If there's multiple returns from the callee contract, only one return value (the last return simulated) will be used in the analysis.
This would have to be fixed buy moving call_stack
into the global state and returning on exception/stop, however this would create a much larger state space.
See contract comments.
Two graph generated for comparison.
call_ret_value.origin.graph.html
call_ret_value.improved.graph.html
This commit do as follows:
Add
RETURNDATASIZE
op: missing this caused misplaced stack after contract function call.Set output memory for
CALL
&CALLCODE
op: should store callretval
to memory, otherwise wrong value will beMLOAD
from mem.TODOs:
[ ] Not sure this fix will break other code or not.
[ ] This if branch is complicated and could forget to store
retval
to memory in several places.