summaryrefslogtreecommitdiff
path: root/src/tools/fuzzing/fuzzing.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/fuzzing/fuzzing.cpp')
-rw-r--r--src/tools/fuzzing/fuzzing.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/tools/fuzzing/fuzzing.cpp b/src/tools/fuzzing/fuzzing.cpp
index f4f059deb..57c7ec6b0 100644
--- a/src/tools/fuzzing/fuzzing.cpp
+++ b/src/tools/fuzzing/fuzzing.cpp
@@ -224,13 +224,14 @@ void TranslateToFuzzReader::setupMemory() {
auto segment = builder.makeDataSegment();
segment->memory = memory->name;
segment->offset = builder.makeConst(int32_t(0));
- segment->setName(Name::fromInt(0), false);
- wasm.dataSegments.push_back(std::move(segment));
+ segment->setName(Names::getValidDataSegmentName(wasm, Name::fromInt(0)),
+ false);
auto num = upTo(USABLE_MEMORY * 2);
for (size_t i = 0; i < num; i++) {
auto value = upTo(512);
- wasm.dataSegments[0]->data.push_back(value >= 256 ? 0 : (value & 0xff));
+ segment->data.push_back(value >= 256 ? 0 : (value & 0xff));
}
+ wasm.addDataSegment(std::move(segment));
}
}