Bug 251133 - [Wasm-GC] Fix null checks for struct operations
Summary: [Wasm-GC] Fix null checks for struct operations
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebAssembly (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks: 247394
  Show dependency treegraph
 
Reported: 2023-01-24 21:15 PST by Asumu Takikawa
Modified: 2023-01-26 12:13 PST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Asumu Takikawa 2023-01-24 21:15:57 PST
There's a bug in the implementation of Wasm GC struct instructions such as `struct.get` and `struct.set`, in that they don't correctly implement null ref checks.

Here's an example test case (can run in the JSTests/wasm/gc test directory):

```
import * as assert from "../assert.js";
import { compile, instantiate } from "./wast-wrapper.js";

let m = instantiate(`
  (module
    (type (struct (field i32)))
    (func (export "f") (result i32)
      (struct.get 0 0 (ref.null 0)))
  )
`);

m.exports.f();
```

This currently crashes, instead of raising a trap exception as needed.
Comment 1 Asumu Takikawa 2023-01-24 21:34:47 PST
Pull request: https://github.com/WebKit/WebKit/pull/9091
Comment 2 EWS 2023-01-26 12:12:01 PST
Committed 259449@main (a5a87681d68f): <https://commits.webkit.org/259449@main>

Reviewed commits have been landed. Closing PR #9091 and removing active labels.
Comment 3 Radar WebKit Bug Importer 2023-01-26 12:13:17 PST
<rdar://problem/104707623>