Sfoglia il codice sorgente

LibWasm: Properly read data section tags

The previous version of the function read the tag as a u8. However, as
per the spec, the tag of the data section should be a u32, LEB128
encoded.

https://webassembly.github.io/spec/core/binary/modules.html#data-section
Diego 1 anno fa
parent
commit
ed8d036b41
1 ha cambiato i file con 1 aggiunte e 1 eliminazioni
  1. 1 1
      Userland/Libraries/LibWasm/Parser/Parser.cpp

+ 1 - 1
Userland/Libraries/LibWasm/Parser/Parser.cpp

@@ -1552,7 +1552,7 @@ ParseResult<CodeSection> CodeSection::parse(Stream& stream)
 ParseResult<DataSection::Data> DataSection::Data::parse(Stream& stream)
 {
     ScopeLogger<WASM_BINPARSER_DEBUG> logger("Data"sv);
-    auto tag_or_error = stream.read_value<u8>();
+    auto tag_or_error = stream.read_value<LEB128<size_t>>();
     if (tag_or_error.is_error())
         return with_eof_check(stream, ParseError::ExpectedKindTag);