mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-01 16:02:53 +00:00
LibWasm: Correctly validate v128_load*_lane
instructions
This commit is contained in:
parent
f5326f1747
commit
8a0ef17d9a
Notes:
sideshowbarker
2024-07-17 06:51:40 +09:00
Author: https://github.com/dzfrias
Commit: 8a0ef17d9a
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/635
Reviewed-by: https://github.com/alimpfard ✅
1 changed files with 2 additions and 2 deletions
|
@ -2847,7 +2847,7 @@ VALIDATE_INSTRUCTION(v128_load8_lane)
|
|||
constexpr auto max_lane = 128 / N;
|
||||
constexpr auto max_alignment = N / 8;
|
||||
|
||||
if (arg.lane > max_lane)
|
||||
if (arg.lane >= max_lane)
|
||||
return Errors::out_of_bounds("lane index"sv, arg.lane, 0u, max_lane);
|
||||
|
||||
TRY(validate(arg.memory.memory_index));
|
||||
|
@ -2906,7 +2906,7 @@ VALIDATE_INSTRUCTION(v128_load64_lane)
|
|||
|
||||
TRY(validate(arg.memory.memory_index));
|
||||
|
||||
if (arg.memory.align > max_alignment)
|
||||
if ((1 << arg.memory.align) > max_alignment)
|
||||
return Errors::out_of_bounds("memory op alignment"sv, 1 << arg.memory.align, 0u, max_alignment);
|
||||
|
||||
return stack.take_and_put<ValueType::V128, ValueType::I32>(ValueType::V128);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue