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

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

Issue 2481263003: [wasm] Mutable globals cannot be exported (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/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 8c0f234f4432263e2d23b3adffbf5fa5b2ca13cc..a7dd3e3f0a3e2eb4e1ea08623f15c21dfd3cac4a 100644
--- a/test/unittests/wasm/module-decoder-unittest.cc
+++ b/test/unittests/wasm/module-decoder-unittest.cc
@@ -248,6 +248,47 @@ TEST_F(WasmModuleVerifyTest, ZeroGlobals) {
if (result.val) delete result.val;
}
+TEST_F(WasmModuleVerifyTest, ExportMutableGlobal) {
+ {
+ static const byte data[] = {
+ SECTION(Global, 6), // --
+ 1,
+ kLocalI32, // local type
+ 0, // immutable
+ WASM_INIT_EXPR_I32V_1(13), // init
+ SECTION(Export, 8), // --
+ 1, // Export count
+ 4, // name length
+ 'n', // --
+ 'a', // --
+ 'm', // --
+ 'e', // --
+ kExternalGlobal, // global
+ 0, // global index
+ };
+ EXPECT_VERIFIES(data);
+ }
+ {
+ static const byte data[] = {
+ SECTION(Global, 6), // --
+ 1, // --
+ kLocalI32, // local type
+ 1, // mutable
+ WASM_INIT_EXPR_I32V_1(13), // init
+ SECTION(Export, 8), // --
+ 1, // Export count
+ 4, // name length
+ 'n', // --
+ 'a', // --
+ 'm', // --
+ 'e', // --
+ kExternalGlobal, // global
+ 0, // global index
+ };
+ EXPECT_FAILURE(data);
+ }
+}
+
static void AppendUint32v(std::vector<byte>& buffer, uint32_t val) {
while (true) {
uint32_t next = val >> 7;
« 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