mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-08-23 23:33:45 +02:00
Fix stack pointer corruption in binding-base.h
This commit is contained in:
parent
3ace4ad6ae
commit
8e9e7700f0
1 changed files with 2 additions and 2 deletions
|
@ -123,7 +123,6 @@ namespace mkxp_sandbox {
|
||||||
}
|
}
|
||||||
|
|
||||||
static wasm_ptr_t init_inner(struct binding_base &bind, struct fiber &fiber) {
|
static wasm_ptr_t init_inner(struct binding_base &bind, struct fiber &fiber) {
|
||||||
wasm_ptr_t sp = w2c_ruby_rb_wasm_get_stack_pointer(&bind.instance());
|
|
||||||
uint32_t state = w2c_ruby_asyncify_get_state(&bind.instance());
|
uint32_t state = w2c_ruby_asyncify_get_state(&bind.instance());
|
||||||
|
|
||||||
if (fiber.stack_ptr > fiber.stack.size()) {
|
if (fiber.stack_ptr > fiber.stack.size()) {
|
||||||
|
@ -145,11 +144,12 @@ namespace mkxp_sandbox {
|
||||||
fiber.stack.pop_back();
|
fiber.stack.pop_back();
|
||||||
}
|
}
|
||||||
++fiber.stack_ptr;
|
++fiber.stack_ptr;
|
||||||
|
wasm_ptr_t sp = w2c_ruby_rb_wasm_get_stack_pointer(&bind.instance()) - SIZEOF_WASMSTACKALIGN(T);
|
||||||
fiber.stack.emplace_back(
|
fiber.stack.emplace_back(
|
||||||
bind,
|
bind,
|
||||||
stack_frame_destructor,
|
stack_frame_destructor,
|
||||||
boost::typeindex::type_id<T>(),
|
boost::typeindex::type_id<T>(),
|
||||||
(sp -= SIZEOF_WASMSTACKALIGN(T))
|
sp
|
||||||
);
|
);
|
||||||
assert(sp % sizeof(VALUE) == 0);
|
assert(sp % sizeof(VALUE) == 0);
|
||||||
assert(sp % WASMSTACKALIGN == 0);
|
assert(sp % WASMSTACKALIGN == 0);
|
||||||
|
|
Loading…
Add table
Reference in a new issue