| Index: src/wasm/ast-decoder.h
|
| diff --git a/src/wasm/ast-decoder.h b/src/wasm/ast-decoder.h
|
| index d173986e72c1fd86e80d8b18e030b000539c33ee..4693af1ca0b2435f93ecb41606dcd89688d8e1e3 100644
|
| --- a/src/wasm/ast-decoder.h
|
| +++ b/src/wasm/ast-decoder.h
|
| @@ -142,24 +142,23 @@ struct ImportIndexOperand {
|
| }
|
| };
|
|
|
| -struct TableSwitchOperand {
|
| - uint32_t case_count;
|
| +struct BranchTableOperand {
|
| uint32_t table_count;
|
| const byte* table;
|
| int length;
|
| - inline TableSwitchOperand(Decoder* decoder, const byte* pc) {
|
| - case_count = decoder->checked_read_u16(pc, 1, "expected #cases");
|
| - table_count = decoder->checked_read_u16(pc, 3, "expected #entries");
|
| - length = 4 + table_count * 2;
|
| + inline BranchTableOperand(Decoder* decoder, const byte* pc) {
|
| + table_count = decoder->checked_read_u16(pc, 1, "expected #entries");
|
| + length = 2 + table_count * 2 + 2;
|
|
|
| - if (decoder->check(pc, 5, table_count * 2, "expected <table entries>")) {
|
| - table = pc + 5;
|
| + if (decoder->check(pc, 3, table_count * 2 + 2,
|
| + "expected <table entries>")) {
|
| + table = pc + 3;
|
| } else {
|
| table = nullptr;
|
| }
|
| }
|
| inline uint16_t read_entry(Decoder* decoder, int i) {
|
| - DCHECK(i >= 0 && static_cast<uint32_t>(i) < table_count);
|
| + DCHECK(i >= 0 && static_cast<uint32_t>(i) <= table_count);
|
| return table ? decoder->read_u16(table + i * sizeof(uint16_t)) : 0;
|
| }
|
| };
|
|
|