Skip to content

Commit

Permalink
Find single push_end value
Browse files Browse the repository at this point in the history
  • Loading branch information
chfast committed Sep 17, 2019
1 parent 408ad24 commit 95b9b04
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/evmone/analysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ code_analysis analyze(evmc_revision rev, const uint8_t* code, size_t code_size)
case ANY_SMALL_PUSH:
{
const auto push_size = static_cast<size_t>(opcode - OP_PUSH1) + 1;
const auto push_end = code_pos + push_size;
const auto push_end = std::min(code_pos + push_size, code_end);

uint64_t value = 0;
auto insert_bit_pos = (push_size - 1) * 8;
while (code_pos < push_end && code_pos < code_end)
while (code_pos < push_end)
{
value |= uint64_t{*code_pos++} << insert_bit_pos;
insert_bit_pos -= 8;
Expand Down

0 comments on commit 95b9b04

Please sign in to comment.