Skip to content

Commit

Permalink
baseline: Fix output buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
chfast committed Dec 17, 2020
1 parent dff51a6 commit 8cac359
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/evmone/baseline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,8 @@ inline void op_return(ExecutionState& state) noexcept
return;
}

state.output_offset = static_cast<size_t>(offset);
state.output_size = static_cast<size_t>(size);
if (state.output_size != 0)
state.output_offset = static_cast<size_t>(offset);
state.status = StatusCode;
}

Expand Down Expand Up @@ -721,7 +720,8 @@ evmc_result baseline_execute(evmc_vm* /*vm*/, const evmc_host_interface* host,
const auto gas_left =
(state->status == EVMC_SUCCESS || state->status == EVMC_REVERT) ? state->gas_left : 0;

return evmc::make_result(
state->status, gas_left, &state->memory[state->output_offset], state->output_size);
return evmc::make_result(state->status, gas_left,
state->output_size != 0 ? &state->memory[state->output_offset] : nullptr,
state->output_size);
}
} // namespace evmone

0 comments on commit 8cac359

Please sign in to comment.