diff options
-rw-r--r-- | src/wasm-binary.h | 9 | ||||
-rw-r--r-- | test/kitchen_sink.wast.fromBinary | 4 | ||||
-rw-r--r-- | test/unit.wast.fromBinary | 4 |
3 files changed, 11 insertions, 6 deletions
diff --git a/src/wasm-binary.h b/src/wasm-binary.h index f86a19aa8..d2959c69d 100644 --- a/src/wasm-binary.h +++ b/src/wasm-binary.h @@ -1187,14 +1187,15 @@ public: if (debug) std::cerr << "== readDataSegments" << std::endl; auto num = getLEB128(); for (size_t i = 0; i < num; i++) { - auto curr = allocator.alloc<Memory::Segment>(); - curr->offset = getInt32(); + Memory::Segment curr; + curr.offset = getInt32(); auto start = getInt32(); auto size = getInt32(); auto buffer = malloc(size); memcpy(buffer, &input[start], size); - curr->data = (const char*)buffer; - curr->size = size; + curr.data = (const char*)buffer; + curr.size = size; + wasm.memory.segments.push_back(curr); verifyInt8(1); // load at program start } } diff --git a/test/kitchen_sink.wast.fromBinary b/test/kitchen_sink.wast.fromBinary index 1000fc759..9003516cb 100644 --- a/test/kitchen_sink.wast.fromBinary +++ b/test/kitchen_sink.wast.fromBinary @@ -1,5 +1,7 @@ (module - (memory 4096 4096) + (memory 4096 4096 + (segment 1026 "\14\00") + ) (type $0 (func (result i32))) (func $kitchensink (result i32) (block $label$0 diff --git a/test/unit.wast.fromBinary b/test/unit.wast.fromBinary index de479dea7..9c2dfa3f2 100644 --- a/test/unit.wast.fromBinary +++ b/test/unit.wast.fromBinary @@ -1,5 +1,7 @@ (module - (memory 4096 4096) + (memory 4096 4096 + (segment 1026 "\14\00") + ) (type $0 (func (param f32))) (type $1 (func)) (type $2 (func (param f64) (result i32))) |