Corrupted function argument of type list<list<string>>
@ydnar đang làm issue này rồi.
Từ ngày 16/5/2025.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
Description
echo "`wit-bindgen-go version` | `tinygo version` | `wasmtime --version` | `uname -m`"
wit-bindgen-go version v0.6.2 | tinygo version 0.37.0 darwin/arm64 (using go version go1.24.3 and LLVM version 19.1.2) | wasmtime 32.0.0 (d3054950c 2025-04-21) | arm64
A function argument of type list<list<string>> is corrupted when passed between two components created using wit-bindgen-go.
The components, host and guest, target the WIT worlds defined below:
world guest {
... wasi imports ...
export foo: func(name: list<list<string>>);
}
world host {
... wasi imports...
import foo: func(name: list<list<string>>);
export wasi:cli/[email protected];
}
Below is the implementation of run in host:
func main() {
string0 := ...long string literal...
string1 := ...long string literal...
name0 := cm.ToList([]string{string0})
name1 := cm.ToList([]string{string1})
name := cm.ToList([]cm.List[string]{name0, name1})
println("Host:")
el0 := name.Slice()[0]
println("name[0]: len =", el0.Len(), "ptr =", el0.Data())
el1 := name.Slice()[1]
println("name[1]: len =", el1.Len(), "ptr =", el1.Data())
Host.Foo(name)
}
And the implementation of foo in guest:
Guest.Exports.Foo = func(name cm.List[cm.List[string]]) {
println("Guest:")
el0 := name.Slice()[0]
println("name[0]: len =", el0.Len(), "ptr =", el0.Data())
el1 := name.Slice()[1]
println("name[1]: len =", el1.Len(), "ptr =", el1.Data())
}
Component Model bindings are generated using wit-bindgen-go v0.6.2. The components are compiled with TinyGo and executed with Wasmtime.
Steps to reproduce
Here is a zipped directory that reproduces the bug: test-case.zip
- Unzip
test-case.zip cd go-list-list-string- Build and run with
./verify.sh
Expected behavior
The following message should be written to standard output:
Host:
name[0]: len = 0x00000001 ptr = ...
name[1]: len = 0x00000001 ptr = ...
Guest:
name[0]: len = 0x00000001 ptr = ...
name[1]: len = 0x00000001 ptr = ...
Specifically, the lengths printed by each component should be the same.
Actual behavior
The length of name[0] printed by guest is incorrect.
I get the following output:
Host:
name[0]: len = 0x00000001 ptr = 0x0004f570
name[1]: len = 0x00000001 ptr = 0x0004f590
Guest:
name[0]: len = 0xc22490c3 ptr = 0x0d87c35d
name[1]: len = 0x00000001 ptr = 0x00027560
Notes:
- The string literals were reduced as much as possible in an earlier version of the test case, but can likely be further reduced in the attached test case.
- The buggy behavior disappears if
-gc leakingis passed to TinyGo.
Additional context
The Go programs are derived from a test case produced by a differential testing framework for WIT binding generators. The WIT definitions are derived from a test case produced by wit-smith.
- Ngôn ngữ chính
- Go
- Star
- 148
- Fork
- 20
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của bytecodealliance/go-modules
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 48/100
bytecodealliance/go-modules#428 · 1 reaction ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
bytecodealliance/go-modules#411 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
bytecodealliance/go-modules#410 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
bytecodealliance/go-modules#394 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 38/100
bytecodealliance/go-modules#377 · 1 bình luận ·
Tất cả issue của bytecodealliance/go-modules
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
siderolabs/terraform-provider-talos#414 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
JuliaComputing/jh#63 · 1 bình luận ·
-
area/proxy kind/bug priority/backlog triage/accepted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
lexfrei/cloudflare-tunnel-gateway-controller#840 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Priority: Normal Type: Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
cloudflare/cloudflared#1747 ·