Commit Graph

10 Commits

Author SHA1 Message Date
Ali Mohammad Pur
8b0f05c540 LibWasm: Allow vectors of up to 500M entries
This usually shows up in custom sections, containing plain bytes.
2022-10-24 15:54:20 +02:00
Ali Mohammad Pur
82a515a748 LibWasm: Increase the arbitrary local value count per type limit
It was arbitrary, it's still arbitrary, but now it's funny too :^)
2022-03-20 10:44:32 +03:30
Ali Mohammad Pur
d52a26de3f LibWasm: Move the vector size limit to Constants.h and increase it a bit 2021-09-05 15:42:50 +04:30
Ali Mohammad Pur
b64d6bb3a3 LibWasm: Limit the number of function locals
It's possible for the module to request too many locals, we now reject
such modules instead of trying to allocate space for them.
The value itself is chosen arbitrarily, so future tweaks _might_ be
necessary.
Found by OSS-Fuzz: https://oss-fuzz.com/testcase?key=4755809098661888
2021-08-31 16:37:49 +02:00
Ali Mohammad Pur
65355c388b LibWasm: Use AK::StackInfo to track stack size
This way, we can make sure that it doesn't overflow when ASAN is
enabled.
2021-07-12 18:42:45 +04:30
Ali Mohammad Pur
2fc0040ceb LibWasm: Tweak the implementation-defined limits a bit 2021-07-06 17:55:00 +04:30
Ali Mohammad Pur
b538e15548 LibWasm: Give traps a reason and display it when needed
This makes debugging wasm code a bit easier, as we now know what fails
instead of just "too bad, something went wrong".
2021-07-02 04:53:01 +04:30
Ali Mohammad Pur
c4b82ace74 LibWasm: Limit the call stack depth and the number of executed insts
These limits are described in the spec, and we're supposed to stop
execution at some point.
The limits are arbitrarily chosen.
2021-06-22 00:26:25 +04:30
Ali Mohammad Pur
95b9821f26 LibWasm: Implement memory.grow, memory.size and drop
These allow a very basic memory-using program to work.
2021-05-17 23:25:30 +02:00
Ali Mohammad Pur
aa4d8d26b9 LibWasm: Start implementing a basic WebAssembly binary format parser
This can currently parse a really simple module.
Note that it cannot parse the DataCount section, and it's still missing
almost all of the instructions.
This commit also adds a 'wasm' test utility that tries to parse a given
webassembly binary file.
It currently does nothing but exit when the parse fails, but it's a
start :^)
2021-05-08 22:14:39 +02:00