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

Unified Diff: test/cctest/asmjs/test-asm-typer.cc

Issue 2181723002: [wasm][asm2wasm] Fixes a bug in 8-bit heap view accesses. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 5 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/asmjs/asm-typer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/asmjs/test-asm-typer.cc
diff --git a/test/cctest/asmjs/test-asm-typer.cc b/test/cctest/asmjs/test-asm-typer.cc
index 3186afb34ca97f4626fcdf87f7b3fda85df83ec1..21773e952d5715640a0a306839cba403b55c1b42 100644
--- a/test/cctest/asmjs/test-asm-typer.cc
+++ b/test/cctest/asmjs/test-asm-typer.cc
@@ -1908,4 +1908,34 @@ TEST(InvalidSourceLayout) {
}
}
+// This issue was triggered because of the "lenient" 8-bit heap access code
+// path. The canonical heap access index validation fails because __34 is not an
+// intish. Then, during the "lenient" code path for accessing elements in 8-bit
+// heap views, the __34 node in the indexing expression would be re-tagged, thus
+// causing the assertion failure.
+TEST(B63099) {
+ const char* kTests[] = {
+ "function __f_109(stdlib, __v_36, buffer) {\n"
+ " 'use asm';\n"
+ " var __v_34 = new stdlib.Uint8Array(buffer);\n"
+ " function __f_22() {__v_34[__v_34>>0]|0 + 1 | 0;\n"
+ " }\n"
+ "}",
+ "function __f_109(stdlib, __v_36, buffer) {\n"
+ " 'use asm';\n"
+ " var __v_34 = new stdlib.Int8Array(buffer);\n"
+ " function __f_22() {__v_34[__v_34>>0]|0 + 1 | 0;\n"
+ " }\n"
+ "}",
+ };
+
+ for (size_t ii = 0; ii < arraysize(kTests); ++ii) {
+ if (!ValidationOf(Module(kTests[ii]))
+ ->FailsWithMessage("Invalid heap access index")) {
+ std::cerr << "Test:\n" << kTests[ii];
+ CHECK(false);
+ }
+ }
+}
+
} // namespace
« no previous file with comments | « src/asmjs/asm-typer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698