Commit e07641f3 authored by Jakob Kummerow's avatar Jakob Kummerow Committed by Commit Bot

[wasm-c-api] Fix UBSan issue

memcpy doesn't like being called with dest=nullptr and size=0.

Change-Id: Ie01991834a867991ff51287cbe43d22f636b800e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1781695Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63529}
parent 8b89a7c3
......@@ -105,6 +105,7 @@ Name GetNameFromWireBytes(const i::wasm::WireBytesRef& ref,
const i::Vector<const uint8_t>& wire_bytes) {
DCHECK_LE(ref.offset(), wire_bytes.length());
DCHECK_LE(ref.end_offset(), wire_bytes.length());
if (ref.length() == 0) return Name::make();
Name name = Name::make_uninitialized(ref.length());
std::memcpy(name.get(), wire_bytes.begin() + ref.offset(), ref.length());
return name;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment