Say that termcade_init has to come first - #14
Merged
Merged
Conversation
The ABI lists the exports without stating that one of them constructs the game, so a second host implementation reads the table, calls termcade_playfield to learn the framebuffer size, and takes a nil pointer dereference inside the guest. Found by running tetris under a JS WebAssembly engine to see whether the app could host games too. The arcade has always had the order right — abi, init, playfield — which is exactly why nothing caught it: the only host was the one that already knew. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The ABI lists the exports without stating that one of them constructs the game. Read the table and you would reasonably call
termcade_playfieldfirst to learn how big a framebuffer to allocate — and take a nil pointer dereference inside the guest.The arcade has always had the order right (
termcade_abi→termcade_init→termcade_playfield,internal/plugin/wasmgame.go:40-58), which is precisely why nothing caught it: the only host was the one that already knew.How it surfaced
Running
tetris.tcadeunder a JS WebAssembly engine with a WASI preview-1 shim, to find out whether the Expo app could host games rather than only list them. Once the order was fixed, the same package ran 90 frames and rasterised correctly:That is a docs-only change here; the renderer work is separate.
🤖 Generated with Claude Code