Skip to content

Commit 71dc079

Browse files
Markyparky56kripken
authored andcommitted
Move pointer positioning outside of vector access operator to avoid MSVC complaining about out-of-range values (#1233)
1 parent 74d026b commit 71dc079

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/wasm/wasm-binary.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ void WasmBinaryWriter::finishSection(int32_t start) {
9797
if (sizeFieldSize != MaxLEB32Bytes) {
9898
// we can save some room, nice
9999
assert(sizeFieldSize < MaxLEB32Bytes);
100-
std::move(&o[start + MaxLEB32Bytes], &o[start + MaxLEB32Bytes + size], &o[start + sizeFieldSize]);
100+
std::move(&o[start] + MaxLEB32Bytes, &o[start] + MaxLEB32Bytes + size, &o[start] + sizeFieldSize);
101101
o.resize(o.size() - (MaxLEB32Bytes - sizeFieldSize));
102102
}
103103
}
@@ -280,7 +280,7 @@ void WasmBinaryWriter::writeFunctions() {
280280
if (sizeFieldSize != MaxLEB32Bytes) {
281281
// we can save some room, nice
282282
assert(sizeFieldSize < MaxLEB32Bytes);
283-
std::move(&o[start], &o[start + size], &o[sizePos + sizeFieldSize]);
283+
std::move(&o[start], &o[start] + size, &o[sizePos] + sizeFieldSize);
284284
o.resize(o.size() - (MaxLEB32Bytes - sizeFieldSize));
285285
}
286286
}

0 commit comments

Comments
 (0)