From f023c377785d4bd4100645b2e27549d213bc05a4 Mon Sep 17 00:00:00 2001 From: rodiazet Date: Fri, 23 Dec 2022 10:52:44 +0100 Subject: [PATCH] Fix sanitizers error --- lib/evmone/eof.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/evmone/eof.cpp b/lib/evmone/eof.cpp index d0ba690427..779684ce6d 100644 --- a/lib/evmone/eof.cpp +++ b/lib/evmone/eof.cpp @@ -190,7 +190,7 @@ EOFValidationError validate_instructions(evmc_revision rev, bytes_view code) noe assert(!code.empty()); // guaranteed by EOF headers validation size_t i = 0; - uint8_t op = code[0]; + uint8_t op = 0; while (i < code.size()) { op = code[i]; @@ -201,7 +201,7 @@ EOFValidationError validate_instructions(evmc_revision rev, bytes_view code) noe if (op == OP_RJUMPV) { if (i + 1 < code.size()) - i += 1 /* count */ + code[i + 1] * 2 /* tbl */; + i += static_cast(1 /* count */ + code[i + 1] * 2 /* tbl */); else return EOFValidationError::truncated_instruction; } @@ -245,7 +245,8 @@ bool validate_rjump_destinations( const auto count = container[op_pos + 1]; - const int32_t post_offset = 1 + 1 /* count */ + count * REL_OFFSET_SIZE /* tbl */; + const auto post_offset = + static_cast(1 + 1 /* count */ + count * REL_OFFSET_SIZE /* tbl */); for (size_t k = 0; k < count; ++k) {