mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-05-11 12:11:14 +00:00
wasm_runtime.c: Fix fault modification on data segment (#1116)
Fix fault modification on data segment in wasm module which leads to fail to instantiate wasm module next time, reported by #1115. Co-authored-by: yangwenming <yangwenming@bytedance.com>
This commit is contained in:
parent
91222e1e44
commit
5f8d1428d5
|
@ -1333,12 +1333,14 @@ wasm_instantiate(WASMModule *module, bool is_sub_inst, uint32 stack_size,
|
|||
goto fail;
|
||||
}
|
||||
|
||||
data_seg->base_offset.u.i32 =
|
||||
base_offset =
|
||||
globals[data_seg->base_offset.u.global_index].initial_value.i32;
|
||||
}
|
||||
else {
|
||||
base_offset = (uint32)data_seg->base_offset.u.i32;
|
||||
}
|
||||
|
||||
/* check offset */
|
||||
base_offset = (uint32)data_seg->base_offset.u.i32;
|
||||
if (base_offset > memory_size) {
|
||||
LOG_DEBUG("base_offset(%d) > memory_size(%d)", base_offset,
|
||||
memory_size);
|
||||
|
|
Loading…
Reference in New Issue
Block a user