summaryrefslogtreecommitdiff
path: root/src/wasm/wasm-binary.cpp
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2019-04-08 17:26:24 -0700
committerGitHub <noreply@github.com>2019-04-08 17:26:24 -0700
commitb56c691ab87c2cd09255b2617213ec5d8e92a748 (patch)
tree29d8cd53c0481e200a643e68f9bf6d436726ef9b /src/wasm/wasm-binary.cpp
parentc9eeaefbd839cc5176957e479475625fc8b2bcf0 (diff)
downloadbinaryen-b56c691ab87c2cd09255b2617213ec5d8e92a748.tar.gz
binaryen-b56c691ab87c2cd09255b2617213ec5d8e92a748.tar.bz2
binaryen-b56c691ab87c2cd09255b2617213ec5d8e92a748.zip
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.
Diffstat (limited to 'src/wasm/wasm-binary.cpp')
-rw-r--r--src/wasm/wasm-binary.cpp2
1 files changed, 1 insertions, 1 deletions
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);
}