mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 21:29:06 +00:00
LibWasm: Validate that data section exists for some instructions
This commit is contained in:
parent
a7b1a9ded7
commit
67749300c3
Notes:
sideshowbarker
2024-07-17 08:45:34 +09:00
Author: https://github.com/dzfrias
Commit: 67749300c3
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/134
1 changed files with 5 additions and 0 deletions
|
@ -1950,6 +1950,8 @@ VALIDATE_INSTRUCTION(memory_copy)
|
|||
|
||||
VALIDATE_INSTRUCTION(memory_init)
|
||||
{
|
||||
if (!m_context.data_count.has_value())
|
||||
return Errors::invalid("memory.init, requires data count section"sv);
|
||||
|
||||
auto& args = instruction.arguments().get<Instruction::MemoryInitArgs>();
|
||||
|
||||
|
@ -1963,6 +1965,9 @@ VALIDATE_INSTRUCTION(memory_init)
|
|||
|
||||
VALIDATE_INSTRUCTION(data_drop)
|
||||
{
|
||||
if (!m_context.data_count.has_value())
|
||||
return Errors::invalid("data.drop, requires data count section"sv);
|
||||
|
||||
auto index = instruction.arguments().get<DataIndex>();
|
||||
TRY(validate(index));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue