Commit ba14641c authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[wasm] Fix ordering constraint on exception section

R=mstarzinger@chromium.org

Bug: v8:8091
Change-Id: I9564b7836667089112b958f1e8644b35ffa855a8
Reviewed-on: https://chromium-review.googlesource.com/c/1352301
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57904}
parent 9c2fc213
......@@ -361,7 +361,7 @@ class ModuleDecoderImpl : public Decoder {
} else if (next_ordered_section_ > kExportSectionCode) {
errorf(pc(), "Exception section must appear before export section");
return;
} else if (next_ordered_section_ < kImportSectionCode) {
} else if (next_ordered_section_ <= kImportSectionCode) {
next_ordered_section_ = kImportSectionCode + 1;
}
seen_unordered_sections_ |= 1 << kExceptionSectionCode;
......
......@@ -585,6 +585,18 @@ TEST_F(WasmModuleVerifyTest, ExceptionSectionBeforeImport) {
EXPECT_NOT_OK(result, "unexpected section: Import");
}
TEST_F(WasmModuleVerifyTest, ExceptionSectionAfterTypeBeforeImport) {
STATIC_ASSERT(kTypeSectionCode + 1 == kImportSectionCode);
static const byte data[] = {SECTION(Type, ENTRY_COUNT(0)),
SECTION(Exception, ENTRY_COUNT(0)),
SECTION(Import, ENTRY_COUNT(0))};
FAIL_IF_NO_EXPERIMENTAL_EH(data);
WASM_FEATURE_SCOPE(eh);
ModuleResult result = DecodeModule(data, data + sizeof(data));
EXPECT_NOT_OK(result, "unexpected section: Import");
}
TEST_F(WasmModuleVerifyTest, ExceptionImport) {
static const byte data[] = {
SIGNATURES_SECTION_VOID_VOID,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment