Index: test/unittests/wasm/ast-decoder-unittest.cc |
diff --git a/test/unittests/wasm/ast-decoder-unittest.cc b/test/unittests/wasm/ast-decoder-unittest.cc |
index 403c7bc9e8aba3155a8be911b43f0653f755c117..0861e00be1d77732941f418901c868387d8b7170 100644 |
--- a/test/unittests/wasm/ast-decoder-unittest.cc |
+++ b/test/unittests/wasm/ast-decoder-unittest.cc |
@@ -314,13 +314,13 @@ TEST_F(AstDecoderTest, NumLocalAboveLimit) { |
} |
TEST_F(AstDecoderTest, GetLocal_varint) { |
- const int kMaxLocals = kMaxNumWasmLocals; |
+ const int kMaxLocals = kMaxNumWasmLocals - 1; |
AddLocals(kAstI32, kMaxLocals); |
EXPECT_VERIFIES(i_i, kExprGetLocal, U32V_1(66)); |
EXPECT_VERIFIES(i_i, kExprGetLocal, U32V_2(7777)); |
- EXPECT_VERIFIES(i_i, kExprGetLocal, U32V_3(888888)); |
- EXPECT_VERIFIES(i_i, kExprGetLocal, U32V_4(3999999)); |
+ EXPECT_VERIFIES(i_i, kExprGetLocal, U32V_3(8888)); |
+ EXPECT_VERIFIES(i_i, kExprGetLocal, U32V_4(9999)); |
EXPECT_VERIFIES(i_i, kExprGetLocal, U32V_5(kMaxLocals - 1)); |
@@ -334,6 +334,14 @@ TEST_F(AstDecoderTest, GetLocal_varint) { |
EXPECT_FAILURE(i_v, kExprGetLocal, U32V_4(kMaxLocals + 1)); |
} |
+TEST_F(AstDecoderTest, GetLocal_toomany) { |
+ AddLocals(kAstI32, kMaxNumWasmLocals - 100); |
+ AddLocals(kAstI32, 100); |
+ |
+ EXPECT_VERIFIES(i_v, kExprGetLocal, U32V_1(66)); |
+ EXPECT_FAILURE(i_i, kExprGetLocal, U32V_1(66)); |
+} |
+ |
TEST_F(AstDecoderTest, Binops_off_end) { |
byte code1[] = {0}; // [opcode] |
for (size_t i = 0; i < arraysize(kInt32BinopOpcodes); i++) { |