Index: src/wasm/ast-decoder.h |
diff --git a/src/wasm/ast-decoder.h b/src/wasm/ast-decoder.h |
index feafa2618fa52990afea9178a54a6a780ac3d877..4ac6793a85c637969444dfaadf67cd80776c5890 100644 |
--- a/src/wasm/ast-decoder.h |
+++ b/src/wasm/ast-decoder.h |
@@ -186,12 +186,18 @@ 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 len1 = 1; |
unsigned len2 = 0; |
+ table_index = decoder->checked_read_u8(pc, 1, "table index"); |
+ if (table_index != 0) { |
+ decoder->error(pc, pc + 1, "expected table index 0, found %u", |
+ table_index); |
+ } |
index = decoder->checked_read_u32v(pc, 1 + len1, &len2, "signature index"); |
length = len1 + len2; |
sig = nullptr; |
@@ -211,6 +217,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; |