Define data structure size limits
I think we should define clear size limits for for Array, String, Bytes and Buffer.
In particular I tried working with hudge Buffer and Bytes and found the overall situation pretty bad. Mostly resulting in crashes and memory leaks with structures over 1GiB, but possibly in other types of bugs with consequences on security.
I think the best thing to do now is to just limit them to 1073741823 bytes/elements so they fit both in signed i32s and Simple Numbers.
Rising the limit to 2147483647 presents some challenges, but is doable. It's mostly a question of removing assumptions of sizes being simple numbers (see #1072), making good tests and squashing some bugs. For example Buffer directly assigns length in @disableGC functions without accounting for the possibility it may be a heap allocated number.
Rising the limit to 4294967295 may be possible but raises the difficulty considerably and may not be worth the effort since allocating even one such big object is unlikely to fit with the rest of the program in 32bit memory space. It would require either changing code to carefully avoid mixed usage of signed operations with unsigned int32 numbers or working with WasmI64 internally.