RESOLVED INVALID285746
Missing Validation for Element Segment Initialization
https://bugs.webkit.org/show_bug.cgi?id=285746
Summary Missing Validation for Element Segment Initialization
tombox1337
Reported 2025-01-10 07:28:53 PST
Created attachment 473855 [details] program.js ### Description WebKit does not enforce the restriction that element segment initializers can only reference imported globals. According to the [WebAssembly specification](https://webassembly.github.io/spec/core/valid/instructions.html#constant-expressions), globals are not recursive and cannot be accessed within constant expressions when they are defined locally, affecting the initialization of element segments. ### Environment - OS: Ubuntu 20.04 - CPU: amd64 - WebKit Version: 146fa28a329d220785d2972c1d691555141e6406 ### Steps to Reproduce Run the following WebAssembly module: ``` ./JSCOnly/Debug/bin/jsc ./program.js ``` ### Current State ```plaintext (no error or warning) ``` ### Expected Behavior Per the [WebAssembly specification](https://webassembly.github.io/spec/core/valid/instructions.html#constant-expressions), element segment initializers should only be able to reference imported globals. If a locally defined global is accessed, the module should fail validation with an error similar to: ``` initializer expression can only reference an imported global ```
Attachments
program.js (416 bytes, application/x-javascript)
2025-01-10 07:28 PST, tombox1337
no flags
Radar WebKit Bug Importer
Comment 1 2025-01-17 07:29:12 PST
Yusuke Suzuki
Comment 2 2025-01-24 00:41:46 PST
EWS
Comment 3 2025-01-24 13:18:05 PST
Committed 289363@main (ed30693f477a): <https://commits.webkit.org/289363@main> Reviewed commits have been landed. Closing PR #39491 and removing active labels.
WebKit Commit Bot
Comment 4 2025-02-10 13:28:41 PST
Re-opened since this is blocked by bug 287432
Yusuke Suzuki
Comment 5 2025-02-10 13:52:26 PST
This is changed in wasm GC.
Note You need to log in before you can comment on or make changes to this bug.