Index: src/wasm/ast-decoder.h |
diff --git a/src/wasm/ast-decoder.h b/src/wasm/ast-decoder.h |
index feafa2618fa52990afea9178a54a6a780ac3d877..9ce323efcbab6d917e75f166d47637d2e70c3e05 100644 |
--- a/src/wasm/ast-decoder.h |
+++ b/src/wasm/ast-decoder.h |
@@ -186,14 +186,19 @@ struct BreakDepthOperand { |
}; |
struct CallIndirectOperand { |
+ uint32_t table_index; |
uint32_t index; |
FunctionSig* sig; |
unsigned length; |
inline CallIndirectOperand(Decoder* decoder, const byte* pc) { |
- unsigned len1 = 0; |
- unsigned len2 = 0; |
- index = decoder->checked_read_u32v(pc, 1 + len1, &len2, "signature index"); |
- length = len1 + len2; |
+ unsigned len = 0; |
+ index = decoder->checked_read_u32v(pc, 1, &len, "signature index"); |
+ table_index = decoder->checked_read_u8(pc, 1 + len, "table index"); |
+ if (table_index != 0) { |
+ decoder->error(pc, pc + 1 + len, "expected table index 0, found %u", |
+ table_index); |
+ } |
+ length = 1 + len; |
sig = nullptr; |
} |
}; |
@@ -211,6 +216,18 @@ struct CallFunctionOperand { |
} |
}; |
+struct MemoryIndexOperand { |
+ uint32_t index; |
+ unsigned length; |
+ inline MemoryIndexOperand(Decoder* decoder, const byte* pc) { |
+ index = decoder->checked_read_u8(pc, 1, "memory index"); |
+ if (index != 0) { |
+ decoder->error(pc, pc + 1, "expected memory index 0, found %u", index); |
+ } |
+ length = 1; |
+ } |
+}; |
+ |
struct BranchTableOperand { |
uint32_t table_count; |
const byte* start; |