mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 13:36:13 +03:00
LibWasm: Check data section offset for overflow during instantiation
This commit is contained in:
parent
28d4e326f8
commit
bd6ee060d2
Notes:
sideshowbarker
2024-07-17 20:19:08 +09:00
Author: https://github.com/dzfrias Commit: https://github.com/LadybirdBrowser/ladybird/commit/bd6ee060d2 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/97
@ -345,7 +345,9 @@ InstantiationResult AbstractMachine::instantiate(Module const& module, Vector<Ex
|
||||
return;
|
||||
auto address = main_module_instance.memories()[data.index.value()];
|
||||
auto instance = m_store.get(address);
|
||||
if (data.init.size() + offset > instance->size()) {
|
||||
Checked<size_t> checked_offset = data.init.size();
|
||||
checked_offset += offset;
|
||||
if (checked_offset.has_overflow() || checked_offset > instance->size()) {
|
||||
instantiation_result = InstantiationError {
|
||||
ByteString::formatted("Data segment attempted to write to out-of-bounds memory ({}) in memory of size {}",
|
||||
offset, instance->size())
|
||||
|
Loading…
Reference in New Issue
Block a user