Commit d6808c0f authored by Eric Holk's avatar Eric Holk Committed by Commit Bot

[wasm] compile fuzzer: initialize temporary before filling.

BUG= https://bugs.chromium.org/p/chromium/issues/detail?id=697191

Change-Id: I01ddd6824b1a79d86944ac766f5c2070e9b0c244
Reviewed-on: https://chromium-review.googlesource.com/448317Reviewed-by: 's avatarBen Titzer <titzer@chromium.org>
Commit-Queue: Eric Holk <eholk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#43522}
parent a927f81c
......@@ -57,8 +57,13 @@ class DataRange {
if (size() == 0) {
return T();
} else {
// We want to support the case where we have less than sizeof(T) bytes
// remaining in the slice. For example, if we emit an i32 constant, it's
// okay if we don't have a full four bytes available, we'll just use what
// we have. We aren't concerned about endianness because we are generating
// arbitrary expressions.
const size_t num_bytes = std::min(sizeof(T), size());
T result;
T result = T();
memcpy(&result, data_, num_bytes);
data_ += num_bytes;
size_ -= num_bytes;
......
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