[codex] Guard array length against NaN-boxed non-pointers#4150
Merged
proggeramlug merged 1 commit intoJun 2, 2026
Conversation
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.
Summary
Fix a Perry runtime crash in
js_array_lengthwhen callers pass a NaN-boxed non-pointer tag through a path that expects an array-like pointer.The OpenTUI
PerryRenderLib.createRenderer(40, 10, ...)reducer crashed afterbefore-create-rendererwith SIGSEGV. LLDB showedjs_array_lengthcalling the Set/Map registry probes before rejecting a0x7FFC...singleton/hole-style tag, causingis_registered_setto read a GC header from a fake pointer.Changes
js_array_length.undefined,null, booleans,TAG_HOLE, and an int32 tag reachingjs_array_length.Validation
cargo fmt --checkpassed.origin/main,cargo test -p perry-runtime test_array_length_rejects_nanboxed_non_pointers_before_registry_probepassed.cargo build --release -p perry,cargo build --release -p perry-runtime, andcargo build --release -p perry-stdlibpassed./tmp/opentui-perry-create-renderer-syGcGq/create-renderer-fixedreachedafter-create-renderer:3,after-set-use-thread, andafter-destroy-rendererwith rc 0.rustc-LLVM ERROR: IO failure on output stream: No space left on device.intermediateRender; this is a follow-up render/content path blocker, not completion evidence.Notes
This PR is intentionally scoped to the runtime SIGSEGV guard. It does not claim generic OpenTUI smoke completion and does not claim OpenCode/OpenTUI migration completion.