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

Unified Diff: test/cctest/wasm/test-run-wasm-module.cc

Issue 2486183002: [wasm] Fix bounds check in LoadDataSegments. (Closed)
Patch Set: Created 4 years, 1 month 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.cc ('k') | test/common/wasm/wasm-module-runner.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/wasm/test-run-wasm-module.cc
diff --git a/test/cctest/wasm/test-run-wasm-module.cc b/test/cctest/wasm/test-run-wasm-module.cc
index a9694b4882eda999d762482112fb09adb5d4bd36..cf2d6bb189e28a76f7de3e1e6c76f0e844f5a313 100644
--- a/test/cctest/wasm/test-run-wasm-module.cc
+++ b/test/cctest/wasm/test-run-wasm-module.cc
@@ -802,3 +802,40 @@ TEST(Run_WasmModule_Global_f64) {
RunWasmModuleGlobalInitTest<double>(kAstF64, -833.9);
RunWasmModuleGlobalInitTest<double>(kAstF64, 86374.25);
}
+
+TEST(InitDataAtTheUpperLimit) {
+ {
+ Isolate* isolate = CcTest::InitIsolateOnce();
+ HandleScope scope(isolate);
+ testing::SetupIsolateForWasmModule(isolate);
+
+ ErrorThrower thrower(isolate, "Run_WasmModule_InitDataAtTheUpperLimit");
+
+ const byte data[] = {
+ WASM_MODULE_HEADER, // --
+ kMemorySectionCode, // --
+ U32V_1(4), // section size
+ ENTRY_COUNT(1), // --
+ kResizableMaximumFlag, // --
+ 1, // initial size
+ 2, // maximum size
+ kDataSectionCode, // --
+ U32V_1(9), // section size
+ ENTRY_COUNT(1), // --
+ 0, // linear memory index
+ WASM_I32V_3(0xffff), // destination offset
+ kExprEnd,
+ U32V_1(1), // source size
+ 'c' // data bytes
+ };
+
+ testing::CompileInstantiateWasmModuleForTesting(isolate, &thrower, data,
+ data + arraysize(data),
+ ModuleOrigin::kWasmOrigin);
+ if (thrower.error()) {
+ thrower.Reify()->Print();
+ CHECK(false);
+ }
+ }
+ Cleanup();
+}
« no previous file with comments | « src/wasm/wasm-module.cc ('k') | test/common/wasm/wasm-module-runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698