From b56c691ab87c2cd09255b2617213ec5d8e92a748 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Mon, 8 Apr 2019 17:26:24 -0700 Subject: Better memory fuzzing (#1987) Hash the contents of all of memory and log that out in random places in the fuzzer, so we are more sensitive there and can catch memory bugs. Fix UB that was uncovered by this in the binary writing code - if a segment is empty, we should not look at &vector[0], and instead use vector.data(). Add Builder::addExport convenience method. --- src/wasm/wasm-binary.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/wasm/wasm-binary.cpp') diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp index b1fc03017..2ee528392 100644 --- a/src/wasm/wasm-binary.cpp +++ b/src/wasm/wasm-binary.cpp @@ -330,7 +330,7 @@ void WasmBinaryWriter::writeDataSegments() { writeExpression(segment.offset); o << int8_t(BinaryConsts::End); } - writeInlineBuffer(&segment.data[0], segment.data.size()); + writeInlineBuffer(segment.data.data(), segment.data.size()); } finishSection(start); } -- cgit v1.2.3