Skip to content

Commit

Permalink
Merge pull request #22 from AntelopeIO/no_null_memcpy
Browse files Browse the repository at this point in the history
guard against calling `memcpy()` with NULL src
  • Loading branch information
spoonincode authored Mar 10, 2024
2 parents 33e91eb + 407660b commit ee0b142
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion include/eosio/vm/execution_context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ namespace eosio { namespace vm {
auto required_memory = static_cast<uint64_t>(offset) + data_seg.data.size();
EOS_VM_ASSERT(required_memory <= available_memory, wasm_memory_exception, "data out of range");
auto addr = _linear_memory + offset;
memcpy((char*)(addr), data_seg.data.data(), data_seg.data.size());
if(data_seg.data.size())
memcpy((char*)(addr), data_seg.data.data(), data_seg.data.size());
}

// Globals can be different from one WASM code to another.
Expand Down

0 comments on commit ee0b142

Please sign in to comment.