WASM memory corruption after freeing terminal that processed multi-codepoint grapheme clusters
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- typescript, wasm
Hướng nghiên cứu
Bắt đầu bằng cách chạy repro.ts với Bun, sau đó kiểm tra terminal.free và lệnh gọi ghostty_terminal_write được hiển thị tại ghostty-web.js:145. So sánh việc giải phóng một terminal sau văn bản gồm một codepoint với việc giải phóng một terminal sau các cụm grapheme được liệt kê; hoàn tất khi các lệnh gọi createTerminal() và write() tiếp theo không còn gặp lỗi truy cập bộ nhớ ngoài phạm vi.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Environment
- OS: macOS 15.4 (Darwin 25.2.0, arm64)
- Package: [email protected]
- Runtime: Bun 1.3.9
Description
Calling terminal.free() after writing any multi-codepoint grapheme cluster (flag emoji, skin tone modifiers, ZWJ sequences, keycap sequences) corrupts the shared WASM memory. All subsequent createTerminal() + write() calls crash with an out-of-bounds memory access.
Single-codepoint characters (ASCII, CJK, simple emoji like 😀) do not trigger the bug.
Reproduction
import { Ghostty } from "ghostty-web";
const ghostty = await Ghostty.load();
const term1 = ghostty.createTerminal(80, 24);
term1.write("👋🏽"); // Any multi-codepoint grapheme cluster
term1.free(); // ← corrupts WASM memory
const term2 = ghostty.createTerminal(80, 24);
term2.write("Hello"); // ← crashes
Save as repro.ts and run with bun run repro.ts.
Characters that trigger the bug
All multi-codepoint grapheme clusters:
- Flag emoji: 🇺🇸 🇬🇧 🇯🇵 (regional indicator pairs)
- Skin tone: 👋🏽 (base + Fitzpatrick modifier)
- ZWJ families: 👨👩👧 (ZWJ sequences)
- Keycap: 1️⃣ (digit + VS16 + combining enclosing keycap)
Characters that do NOT trigger the bug
Single-codepoint characters:
- ASCII:
Hello - CJK:
漢字 - Simple emoji:
😀(single codepoint, no modifiers)
Error Output
RuntimeError: Out of bounds memory access (evaluating 'this.exports.ghostty_terminal_write(this.handle, g, B.length)')
at write (ghostty-web.js:145:64)
The crash is in ghostty_terminal_write — the WASM linear memory has been corrupted by the preceding free(), so the next write() accesses invalid memory.
Impact
This blocks using ghostty-web for multi-terminal workflows (test suites, terminal pools, tab management) where terminals are created, used, and freed in sequence. If any terminal processes grapheme clusters before being freed, all subsequent terminals in the same WASM instance are broken.
Workaround
Don't free terminals that have processed multi-codepoint grapheme clusters. Leak them instead:
// Instead of term.free(), just abandon the reference
// term.free() // ← skip this
term = null;
Or use one process per terminal (expensive but avoids shared WASM state).
- Ngôn ngữ chính
- TypeScript
- Star
- 2.9k
- Fork
- 174
- 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
Chúng tôi chưa kiểm tra các tệp thiết lập môi trường của dự án này. Hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
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 coder/ghostty-web
-
attachCustomKeyEventHandler inverts xterm.js's return-value contract (silently swallows all input)Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 52/100
coder/ghostty-web#192 ·
-
A single throw inside render() permanently stops the render loop, and a consumer cannot restart itĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 65/100
coder/ghostty-web#189 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 70/100
coder/ghostty-web#188 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 45/100
coder/ghostty-web#187 ·
-
Hyperlink arena exhaustion (StringAllocOutOfMemory) spins the write path instead of degradingĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
coder/ghostty-web#186 · 1 bình luận ·
Tất cả issue của coder/ghostty-web
Issue tương tự
-
module-request
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
ports get and web print 'Port N already in use, trying next...' for every busy port they skipĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
appandflow/stim#1604 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
lingdojo/kana-dojo#31060 · 1 bình luận · 5 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
SSH workspace restore rewrites relative symlinks into the deleted sync-back staging directoryĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
paperclipai/paperclip#14173 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày