Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Raise validation error on element provided but missing table section
Browse files Browse the repository at this point in the history
This was previously a parser error.
axic committed May 27, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 645736f commit e7942f0
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/fizzy/parser.cpp
Original file line number Diff line number Diff line change
@@ -525,7 +525,7 @@ Module parse(bytes_view input)

if (!module.elementsec.empty() && module.tablesec.empty() &&
module.imported_table_types.empty())
throw parser_error("element section encountered without a table section");
throw validation_error("element section encountered without a table section");

if (module.funcsec.size() != code_binaries.size())
throw parser_error("malformed binary: number of function and code entries must match");
2 changes: 1 addition & 1 deletion test/unittests/parser_test.cpp
Original file line number Diff line number Diff line change
@@ -878,7 +878,7 @@ TEST(parser, element_section_no_table_section)
const auto wasm =
bytes{wasm_prefix} + make_section(9, make_vec({"000b"_bytes + make_vec({"00"_bytes})}));
EXPECT_THROW_MESSAGE(
parse(wasm), parser_error, "element section encountered without a table section");
parse(wasm), validation_error, "element section encountered without a table section");
}

TEST(parser, code_section_empty)

0 comments on commit e7942f0

Please sign in to comment.