diff --git a/lib/evmone/baseline.cpp b/lib/evmone/baseline.cpp index b28e365014..a0db79d3a3 100644 --- a/lib/evmone/baseline.cpp +++ b/lib/evmone/baseline.cpp @@ -35,7 +35,8 @@ CodeAnalysis analyze(const uint8_t* code, size_t code_size) // Using "raw" new operator instead of std::make_unique() to get uninitialized array. std::unique_ptr padded_code{new uint8_t[i + 1]}; // +1 for the final STOP. std::copy_n(code, code_size, padded_code.get()); - padded_code[i] = OP_STOP; // Set final STOP at the code end. + // Set final STOP at the code end. + std::fill_n(padded_code.get() + code_size, i + 1 - code_size, uint8_t{OP_STOP}); // TODO: Using fixed-size padding of 33, the padded code buffer and jumpdest bitmap can be // created with single allocation.