mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 09:30:24 +00:00
LibWasm: Check data segment offset at correct time during instantiation
The data segment offset should be checked _before_ checking if the contents of the segment are non-existent.
This commit is contained in:
parent
c2a0c4f581
commit
78c56d80f9
Notes:
sideshowbarker
2024-07-17 03:14:39 +09:00
Author: https://github.com/dzfrias Commit: https://github.com/LadybirdBrowser/ladybird/commit/78c56d80f9 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/185 Reviewed-by: https://github.com/alimpfard
1 changed files with 2 additions and 2 deletions
|
@ -392,8 +392,6 @@ InstantiationResult AbstractMachine::instantiate(Module const& module, Vector<Ex
|
|||
}
|
||||
main_module_instance.datas().append(*maybe_data_address);
|
||||
|
||||
if (data.init.is_empty())
|
||||
return;
|
||||
auto address = main_module_instance.memories()[data.index.value()];
|
||||
auto instance = m_store.get(address);
|
||||
Checked<size_t> checked_offset = data.init.size();
|
||||
|
@ -405,6 +403,8 @@ InstantiationResult AbstractMachine::instantiate(Module const& module, Vector<Ex
|
|||
};
|
||||
return;
|
||||
}
|
||||
if (data.init.is_empty())
|
||||
return;
|
||||
instance->data().overwrite(offset, data.init.data(), data.init.size());
|
||||
},
|
||||
[&](DataSection::Data::Passive const& passive) {
|
||||
|
|
Loading…
Reference in a new issue