From 0f610c594bc97426d7ba368911470872aad7014c Mon Sep 17 00:00:00 2001 From: Ben Smith Date: Thu, 13 Oct 2016 13:17:08 -0700 Subject: Update testsuite and fix tests * `offset=` and `align=` can now specify hex values * data and elem segment offsets are now not checked; they can be out of order or overlapping, and even out-of-bounds if the size is zero * added the new tests `skip-stack-guard-page` and `unwind` --- src/wasm-binary-reader-interpreter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/wasm-binary-reader-interpreter.c') diff --git a/src/wasm-binary-reader-interpreter.c b/src/wasm-binary-reader-interpreter.c index 3155d98f..57d2fa23 100644 --- a/src/wasm-binary-reader-interpreter.c +++ b/src/wasm-binary-reader-interpreter.c @@ -586,7 +586,7 @@ static WasmResult on_data_segment_data(uint32_t index, assert(ctx->init_expr_value.type == WASM_TYPE_I32); uint32_t address = ctx->init_expr_value.value.i32; uint8_t* dst_data = memory->data; - if ((uint64_t)address + (uint64_t)size > memory->byte_size) + if (size > 0 && (uint64_t)address + (uint64_t)size > memory->byte_size) return WASM_ERROR; memcpy(&dst_data[address], src_data, size); return WASM_OK; -- cgit v1.2.3