Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Element segment expressions are evaluated interleaved with table writes during instantiation

オープン
#15,036 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
24/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
rust, wasm
領域
compilers

調査の方向性

Reproduce both snippets with cargo run -- wast foo.wast, then follow the module-instantiation path in the wasmtime crate to where element segment expressions are evaluated and active segments run table.init. The spec order (all expressions evaluated first, then table writes) has to be reflected there, and the change must keep the fast path for the common case. Done when both scripts trap as expected and imported tables are untouched after the trap; run the existing wast spec tests for element segments and tables.

索引モデルが issue の本文から書いたものです。

説明

bug

This test:

(module $M
  (type $t (func (result i32)))
  (table (export "t") 2 funcref)
  (table (export "a") 2 anyref)
  (func (export "call") (param i32) (result i32)
    (call_indirect (type $t) (local.get 0)))
  (func (export "get-a") (param i32) (result i32)
    (i31.get_s (ref.cast (ref i31) (table.get 1 (local.get 0))))))
(register "M" $M)

(assert_trap
  (module
    (type $a (array (mut i64)))
    (import "M" "t" (table 2 funcref))
    (table $t2 1 anyref)
    (func $f (result i32) (i32.const 7))
    (elem (table 0) (i32.const 0) func $f)
    (elem (table $t2) (i32.const 0) anyref
      (array.new_default $a (i32.const 0x7fffffff))))
  "allocation size too large")
(assert_trap (invoke $M "call" (i32.const 0)) "uninitialized element")

fails with:

$ cargo run -- wast foo.wast
Error: failed to run script file 'foo.wast'

Caused by:
    0: failed directive on foo.wast:21
    1: expected trap, got Core([I32(7)])

and the same with the trap in a later element of the same segment:

(assert_trap
  (module
    (type $a (array (mut i64)))
    (import "M" "a" (table 2 anyref))
    (elem (table 0) (i32.const 0) anyref
      (ref.i31 (i32.const 5))
      (array.new_default $a (i32.const 0x7fffffff))))
  "allocation size too large")
(assert_trap (invoke $M "get-a" (i32.const 0)) "null reference")
$ cargo run -- wast foo.wast
Error: failed to run script file 'foo.wast'

Caused by:
    0: failed directive on foo.wast:19
    1: expected trap, got Core([I32(5)])

The spec's instantiation evaluates the element expressions of every segment before running any active segment's table.init, so a trapping expression should leave imported tables untouched.

Fixing this in my opinion is going to need to be balanced with implementation complexity. This is a vanishingly niche use case which in theory shouldn't come along with a large implementation burden. Nevertheless I figured it's worth opening here.

主要言語
Rust
スター
18.8k
フォーク
1.9k
平均マージ
23時間 57分
マージ済み PR(30日)
392

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

bytecodealliance/wasmtime のほかの issue

bytecodealliance/wasmtime の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。