From 00cc486619814a817c03145da481765fe909e818 Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Sun, 7 Jul 2019 19:49:11 +0200 Subject: [PATCH] wasm: set the stack at the start of linear memory This makes sure that a stack overflow will cause a "memory access out of bounds" error instead of a corruption of a global variable. Here is more background on a very similar stack overflow protection: https://blog.japaric.io/stack-overflow-protection/ --- targets/wasm.json | 1 + 1 file changed, 1 insertion(+) diff --git a/targets/wasm.json b/targets/wasm.json index 82fb6ced..e8cdb5e1 100644 --- a/targets/wasm.json +++ b/targets/wasm.json @@ -14,6 +14,7 @@ "ldflags": [ "--allow-undefined", "--no-threads", + "--stack-first", "--export-all" ], "emulator": ["node", "targets/wasm_exec.js"]