Skip to content

Commit

Permalink
LibWasm: Fix memarg multi-memory reading
Browse files Browse the repository at this point in the history
The extension bit for the memory index present in memargs is at
position 6, but we previously checked position 5, which caused a few
spec issues.
  • Loading branch information
dzfrias authored and awesomekling committed Jun 3, 2024
1 parent c76140f commit 50dc1c3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Userland/Libraries/LibWasm/Parser/Parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,8 +388,8 @@ ParseResult<Vector<Instruction>> Instruction::parse(Stream& stream, InstructionP

// Proposal "multi-memory", if bit 6 of alignment is set, then a memory index follows the alignment.
size_t memory_index = 0;
if ((align & 0x20) != 0) {
align &= ~0x20;
if ((align & 0x40) != 0) {
align &= ~0x40;
auto memory_index_or_error = stream.read_value<LEB128<u32>>();
if (memory_index_or_error.is_error())
return with_eof_check(stream, ParseError::InvalidInput);
Expand Down

0 comments on commit 50dc1c3

Please sign in to comment.