Wasm validator disallows name imports longer than 100_000 bytes
Categories
(Core :: JavaScript: WebAssembly, defect, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox146 | --- | fixed |
People
(Reporter: kustermann.martin, Assigned: jpages)
References
(Blocks 1 open bug, )
Details
Attachments
(1 file)
User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36
Steps to reproduce:
We have a dart2wasm compiler and noticed on some programs that JSShell results in a validation error. The root cause of it is that it refuses import names longer than 100_000 bytes.
Normally imported names are surely short.
Though the recent js-string-builtin wasm spec enables a magic import mechanism where one can import JS strings via specially recognized imports.
String constants in Dart applications can exceed 100_000 bytes and cause a wasm validation error. The root cause is due to using of the constant in [0] when decoding import names.
Actual results:
Using a import with name larger than 100_000 bytes results in a wasm validation error.
Expected results:
Looking through the core wasm spec and js-wasm spec (https://webassembly.github.io/spec/js-api/index.html#limits) it's unclear where this 100_000 byte limit comes from.
Can it be that this is not specified?
D8/Chrome doesn't have this issue: It loads & runs the module just fine.
Comment 1•8 months ago
|
||
Looks like this limit comes from bug 1324008 and probably predates 1.0. I'm guessing this limit wasn't ever agreed upon.
Do you know if Chrome has any limit here? I see there is a MaxStringSize in their limits file, but it doesn't seem to be used anywhere [1]. I might be missing something though.
| Reporter | ||
Comment 2•8 months ago
|
||
Do you know if Chrome has any limit here?
V8 team says there's no specific limit for the names themselves, the only limits being general limits (being the u32 index, and JS wasm spec that limits module size to 1 GB
I filed the same bug with WebKit, as they also seem to have this 100k limit: https://bugs.webkit.org/show_bug.cgi?id=299393
Comment 3•8 months ago
|
||
I'm going to open a spec discussion for this. I'm fine with raising the limit, but feel like it'd still be nice to have a limit on name size.
Comment 4•8 months ago
|
||
Comment 5•7 months ago
|
||
The consensus in the above discussion is to not have any JS-API limit on name lengths. We should remove ours. Julien can you do this?
It's basically just removing this limit [1] and updating tests.
| Assignee | ||
Updated•7 months ago
|
| Assignee | ||
Comment 6•7 months ago
|
||
Updated•6 months ago
|
Description
•