Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1013)

Unified Diff: test/unittests/wasm/ast-decoder-unittest.cc

Issue 2574133002: [wasm] Enforce limits for maximums for many WebAssembly binary entities. (Closed)
Patch Set: Address review comments. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/wasm/wasm-module.h ('k') | test/unittests/wasm/module-decoder-unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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++) {
« no previous file with comments | « src/wasm/wasm-module.h ('k') | test/unittests/wasm/module-decoder-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698