mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 05:07:34 +00:00
LibWasm: Correct memory init size when instantiating
These limits are in units of page size, not bytes. Also fixes incorrect debug logs.
This commit is contained in:
parent
4fd43a8f96
commit
4a459d2430
3 changed files with 5 additions and 4 deletions
|
@ -162,7 +162,8 @@ InstantiationResult AbstractMachine::instantiate(const Module& module, Vector<Ex
|
|||
instantiation_result = InstantiationError { String::formatted("Data segment attempted to write to out-of-bounds memory ({}) of max {} bytes", data.init.size() + offset, instance->type().limits().max().value()) };
|
||||
return;
|
||||
}
|
||||
instance->grow(data.init.size() + offset - instance->size());
|
||||
if (instance->size() < data.init.size() + offset)
|
||||
instance->grow(data.init.size() + offset - instance->size());
|
||||
instance->data().overwrite(offset, data.init.data(), data.init.size());
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue