From 71dc0791361a79e4346eb84ebadf77a324767e32 Mon Sep 17 00:00:00 2001 From: "Mark A. Ropper" Date: Fri, 20 Oct 2017 20:33:27 +0100 Subject: Move pointer positioning outside of vector access operator to avoid MSVC complaining about out-of-range values (#1233) --- src/wasm/wasm-binary.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp index f98eff670..6c79a9032 100644 --- a/src/wasm/wasm-binary.cpp +++ b/src/wasm/wasm-binary.cpp @@ -97,7 +97,7 @@ void WasmBinaryWriter::finishSection(int32_t start) { if (sizeFieldSize != MaxLEB32Bytes) { // we can save some room, nice assert(sizeFieldSize < MaxLEB32Bytes); - std::move(&o[start + MaxLEB32Bytes], &o[start + MaxLEB32Bytes + size], &o[start + sizeFieldSize]); + std::move(&o[start] + MaxLEB32Bytes, &o[start] + MaxLEB32Bytes + size, &o[start] + sizeFieldSize); o.resize(o.size() - (MaxLEB32Bytes - sizeFieldSize)); } } @@ -280,7 +280,7 @@ void WasmBinaryWriter::writeFunctions() { if (sizeFieldSize != MaxLEB32Bytes) { // we can save some room, nice assert(sizeFieldSize < MaxLEB32Bytes); - std::move(&o[start], &o[start + size], &o[sizePos + sizeFieldSize]); + std::move(&o[start], &o[start] + size, &o[sizePos] + sizeFieldSize); o.resize(o.size() - (MaxLEB32Bytes - sizeFieldSize)); } } -- cgit v1.2.3