[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/448317 Reviewed-by: Ben Titzer <titzer@chromium.org> Commit-Queue: Eric Holk <eholk@chromium.org> Cr-Commit-Position: refs/heads/master@{#43522}
This commit is contained in:
parent
a927f81c7c
commit
d6808c0f9c
@ -57,8 +57,13 @@ class DataRange {
|
|||||||
if (size() == 0) {
|
if (size() == 0) {
|
||||||
return T();
|
return T();
|
||||||
} else {
|
} 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());
|
const size_t num_bytes = std::min(sizeof(T), size());
|
||||||
T result;
|
T result = T();
|
||||||
memcpy(&result, data_, num_bytes);
|
memcpy(&result, data_, num_bytes);
|
||||||
data_ += num_bytes;
|
data_ += num_bytes;
|
||||||
size_ -= num_bytes;
|
size_ -= num_bytes;
|
||||||
|
Loading…
Reference in New Issue
Block a user