Hmm okay so WebAssembly has basically two stacks, one with the WASM vars and one for variables that need to be spilled to memory. What happens if the memory stack overflows?

Oh... it just... underflows the stack pointer and starts stomping memory. Welp.

Oh yeah and there's some stuff that sorta kinda lets you set stack limits, which is fine as long as you don't have functions trying to allocate so much stack space that it underflows.

That means you can't pass negative numbers to alloca either, right?

.......... Right?

.... Welp.

Conceptually WASM is kinda cool but so much of it feels rushed to minimum-viable-product without considering important details.

The stack pointer handling is.... bad.

Practically every non-trivial language feature (longjmp, exceptions, threads) has multiple conflicting implementations or proposals.

A lot of these things only require proposals in the first place because of specific design decisions that prevented them from working from the outset.