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

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

Issue 1695233002: wasm - replace the WLL section with support to skip all unknown sections. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 4 years, 10 months 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/module-decoder.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/unittests/wasm/module-decoder-unittest.cc
diff --git a/test/unittests/wasm/module-decoder-unittest.cc b/test/unittests/wasm/module-decoder-unittest.cc
index 467ffcc2320d0c320532dbe31db53bdb03be545d..81816740fba5089e403e1690d0a25066785590f6 100644
--- a/test/unittests/wasm/module-decoder-unittest.cc
+++ b/test/unittests/wasm/module-decoder-unittest.cc
@@ -936,17 +936,17 @@ TEST_F(WasmFunctionVerifyTest, Ok_v_v_empty) {
}
-TEST_F(WasmModuleVerifyTest, WLLSectionNoLen) {
+TEST_F(WasmModuleVerifyTest, SkipSectionNoLen) {
const byte data[] = {
- kDeclWLL, // section without length.
+ 0x5e, // misc section without length.
};
EXPECT_FAILURE(data);
}
-TEST_F(WasmModuleVerifyTest, WLLSectionEmpty) {
+TEST_F(WasmModuleVerifyTest, SkipSectionEmpty) {
static const byte data[] = {
- kDeclWLL, 0, // empty section
+ 0x5e, U32_LE(0), // misc empty section
};
ModuleResult result = DecodeModule(data, data + arraysize(data));
EXPECT_TRUE(result.ok());
@@ -954,11 +954,11 @@ TEST_F(WasmModuleVerifyTest, WLLSectionEmpty) {
}
-TEST_F(WasmModuleVerifyTest, WLLSectionOne) {
+TEST_F(WasmModuleVerifyTest, SkipSectionOne) {
static const byte data[] = {
- kDeclWLL,
- 1, // LEB128 1
- 0, // one byte section
+ 0x5e, // misc section
+ U32_LE(1),
+ 0, // one byte section
};
ModuleResult result = DecodeModule(data, data + arraysize(data));
EXPECT_TRUE(result.ok());
@@ -966,11 +966,11 @@ TEST_F(WasmModuleVerifyTest, WLLSectionOne) {
}
-TEST_F(WasmModuleVerifyTest, WLLSectionTen) {
+TEST_F(WasmModuleVerifyTest, SkipSectionTen) {
static const byte data[] = {
- kDeclWLL,
- 10, // LEB128 10
- 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, // 10 byte section
+ 0x5e,
+ U32_LE(10),
+ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, // 10 byte section
};
ModuleResult result = DecodeModule(data, data + arraysize(data));
EXPECT_TRUE(result.ok());
@@ -978,30 +978,32 @@ TEST_F(WasmModuleVerifyTest, WLLSectionTen) {
}
-TEST_F(WasmModuleVerifyTest, WLLSectionOverflow) {
+TEST_F(WasmModuleVerifyTest, SkipSectionOverflow) {
static const byte data[] = {
- kDeclWLL,
- 11, // LEB128 11
- 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, // 10 byte section
+ 0x5e,
+ U32_LE(11),
+ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, // 10 byte section
};
EXPECT_FAILURE(data);
}
-TEST_F(WasmModuleVerifyTest, WLLSectionUnderflow) {
+TEST_F(WasmModuleVerifyTest, SkipSectionUnderflow) {
static const byte data[] = {
- kDeclWLL, 0xff, 0xff, 0xff, 0xff, 0x0f, // LEB128 0xffffffff
- 1, 2, 3, 4, // 4 byte section
+ 0x5e,
+ U32_LE(0xffffffff),
+ 1, 2, 3, 4, // 4 byte section
};
EXPECT_FAILURE(data);
}
-TEST_F(WasmModuleVerifyTest, WLLSectionLoop) {
+TEST_F(WasmModuleVerifyTest, SkipSectionLoop) {
// Would infinite loop decoding if wrapping and allowed.
static const byte data[] = {
- kDeclWLL, 0xfa, 0xff, 0xff, 0xff, 0x0f, // LEB128 0xfffffffa
- 1, 2, 3, 4, // 4 byte section
+ 0x5e,
+ U32_LE(0xfffffffa),
+ 1, 2, 3, 4, // 4 byte section
};
EXPECT_FAILURE(data);
}
« no previous file with comments | « src/wasm/module-decoder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698