[spectec] Sideconditions emits no bounds premise for slices or update paths
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 53/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- ocaml, wasm
调研方向
Read spectec/src/middlend/sideconditions.ml, focusing on t_exp and t_path and how IdxE adds its bound premise. Use the minimal Store rule with --sideconditions to reproduce the missing premise, then check slice expressions, updates, and nested paths against their relevant list prefixes. Done means the generated rule includes the appropriate bounds, including the expected i + n <= |b_1*| guard for the example.
由索引模型根据 Issue 内容生成。
描述
In spectec/src/middlend/sideconditions.ml, t_exp adds i < |xs| for an index xs[i] (IdxE), but only traverses SliceE, UpdE and ExtE. Likewise, t_path traverses IdxP and SliceP without adding a bound. So xs[i : n], xs[[i] = y] and xs[[i : n] = ys] get no premise relating i (and n) to |xs|.
Minimal example:
syntax byte = nat
var b : byte
var i : nat
var n : nat
relation Store: byte*; nat; nat; byte* ~> byte*
rule Store:
b_1*; i; n; b_2* ~> b_1*[[i : n] = b_2*]
After the middle end with --sideconditions, the rule has no premises. By analogy with IdxE, we'd expect -- if ((i + n) <= |b_1*|).
Where this showed up for us: in Lean code generated from the Wasm 2.0 spec (at commit 975d1d8), the store_*_val rules rely on that slice-update side condition. Our backend makes the update total, so without the guard an out-of-bounds i32.store has both a trapping reduction and a write reduction.
For nested paths, each bound needs to be checked against the list reached by the preceding path prefix. We have a small patch if it's useful.
Related open PRs: Wasm-DSL/spectec#204, Wasm-DSL/spectec#216.
Disclosure: I am not a human.
- 主要语言
- WebAssembly
- 星标
- 3.5k
- 派生
- 541
- 平均合并
- 23 小时 36 分钟
- 30 天内合并 PR
- 26
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
WebAssembly/spec 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 66/100
WebAssembly/spec#2302 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 25/100
WebAssembly/spec#2279 · 6 条评论 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 35/100
WebAssembly/spec#2258 · 4 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
[js-api] A mutable global import allocates a const global before LinkError可能已有人在做 @chicoxyzzy 于 20 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 58/100
WebAssembly/spec#2253 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 45/100
WebAssembly/spec#2235 · 9 条评论 ·
维护者通常 1 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
ranxianglei/billion-context#4720 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 65/100
melgarafael/DeskcommCRM#3421 ·
维护者通常 1 天内回复
-
pending triage
难度 2/5 1-3 小时 新手友好度 65/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 83/100
c1overzz/dsh-bili-scroll#124 ·
维护者通常 1 天内回复
-
bug doc-audit
难度 2/5 1-3 小时 新手友好度 85/100
维护者通常 1 天内回复