mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 05:09:12 +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
Notes:
sideshowbarker
2024-07-18 17:23:20 +09:00
Author: https://github.com/alimpfard
Commit: 4a459d2430
Pull-request: https://github.com/SerenityOS/serenity/pull/7395
Reviewed-by: https://github.com/linusg
3 changed files with 5 additions and 4 deletions
|
@ -80,7 +80,7 @@ ReadonlyBytes Interpreter::load_from_memory(Configuration& configuration, const
|
|||
auto instance_address = base.value() + static_cast<i64>(arg.offset);
|
||||
if (instance_address < 0 || static_cast<u64>(instance_address + size) > memory->size()) {
|
||||
m_do_trap = true;
|
||||
dbgln("LibWasm: Memory access out of bounds (expected 0 > {} and {} > {})", instance_address, instance_address + size, memory->size());
|
||||
dbgln("LibWasm: Memory access out of bounds (expected 0 <= {} and {} <= {})", instance_address, instance_address + size, memory->size());
|
||||
return {};
|
||||
}
|
||||
dbgln_if(WASM_TRACE_DEBUG, "load({} : {}) -> stack", instance_address, size);
|
||||
|
@ -98,7 +98,7 @@ void Interpreter::store_to_memory(Configuration& configuration, const Instructio
|
|||
auto instance_address = base.value() + static_cast<i64>(arg.offset);
|
||||
if (instance_address < 0 || static_cast<u64>(instance_address + data.size()) > memory->size()) {
|
||||
m_do_trap = true;
|
||||
dbgln("LibWasm: Memory access out of bounds (expected 0 > {} and {} > {})", instance_address, instance_address + data.size(), memory->size());
|
||||
dbgln("LibWasm: Memory access out of bounds (expected 0 <= {} and {} <= {})", instance_address, instance_address + data.size(), memory->size());
|
||||
return;
|
||||
}
|
||||
dbgln_if(WASM_TRACE_DEBUG, "tempoaray({}b) -> store({})", data.size(), instance_address);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue