Skip to content

Commit 00cc486

Browse files
aykevldeadprogram
authored andcommitted
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/
1 parent d627208 commit 00cc486

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

targets/wasm.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"ldflags": [
1515
"--allow-undefined",
1616
"--no-threads",
17+
"--stack-first",
1718
"--export-all"
1819
],
1920
"emulator": ["node", "targets/wasm_exec.js"]

0 commit comments

Comments
 (0)