diff options
Diffstat (limited to 'src/wasm/wasm-validator.cpp')
-rw-r--r-- | src/wasm/wasm-validator.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp index 274e1fd1c..d8dba953f 100644 --- a/src/wasm/wasm-validator.cpp +++ b/src/wasm/wasm-validator.cpp @@ -1425,9 +1425,9 @@ void FunctionValidator::visitMemoryInit(MemoryInit* curr) { if (!shouldBeTrue(!!memory, curr, "memory.init memory must exist")) { return; } - shouldBeTrue(curr->segment < getModule()->dataSegments.size(), + shouldBeTrue(getModule()->getDataSegmentOrNull(curr->segment), curr, - "memory.init segment index out of bounds"); + "memory.init segment should exist"); } void FunctionValidator::visitDataDrop(DataDrop* curr) { @@ -1442,9 +1442,9 @@ void FunctionValidator::visitDataDrop(DataDrop* curr) { "Memory operations require a memory")) { return; } - shouldBeTrue(curr->segment < getModule()->dataSegments.size(), + shouldBeTrue(getModule()->getDataSegment(curr->segment), curr, - "data.drop segment index out of bounds"); + "data.drop segment should exist"); } void FunctionValidator::visitMemoryCopy(MemoryCopy* curr) { @@ -2722,16 +2722,16 @@ void FunctionValidator::visitArrayNewSeg(ArrayNewSeg* curr) { "array.new_{data, elem} size must be an i32"); switch (curr->op) { case NewData: - if (!shouldBeTrue(curr->segment < getModule()->dataSegments.size(), + if (!shouldBeTrue(getModule()->getDataSegment(curr->segment), curr, - "array.new_data segment index out of bounds")) { + "array.new_data segment should exist")) { return; } break; case NewElem: - if (!shouldBeTrue(curr->segment < getModule()->elementSegments.size(), + if (!shouldBeTrue(getModule()->getElementSegment(curr->segment), curr, - "array.new_elem segment index out of bounds")) { + "array.new_elem segment should exist")) { return; } break; @@ -2762,7 +2762,7 @@ void FunctionValidator::visitArrayNewSeg(ArrayNewSeg* curr) { "array.new_data result element type should be numeric"); break; case NewElem: - shouldBeSubType(getModule()->elementSegments[curr->segment]->type, + shouldBeSubType(getModule()->getElementSegment(curr->segment)->type, elemType, curr, "array.new_elem segment type should be a subtype of the " |