Repository navigation
rc: a new array given straight to a call is held across it - #649
Merged
Merged
Conversation
A new array is born at count 0 under rc, and one built for an argument (`g([mk(1)])`) had no other owner. A count the callee took and gave back freed the array the callee still read: an alias in a loop or a try (`const a = p`), or the parameter assigned, which copies it into a local that owns it. Nothing ever gave such an array back either. holdGlobalArguments now also holds an array made for the call (a new array, or a constant array copied to the heap by its cast, used only by the call): retained where it is made, released after the call. Fuzzer (#646) R3 / R3b. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 23, 2026
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.
Fixes fuzzer bug R3 / R3b (#646): an alias of an array parameter, or the parameter reassigned, over-released a new array the caller had passed straight in.
Why
Under rc a new array is created at count 0 (
bornUncounted). One built for an argument, such asg([mk(6)]), had no other owner. Any count the callee took and gave back dropped it to 0 and freed an array the callee was still using:const a = p);Nothing ever gave such an array back after the call either, so it leaked.
Fix (rc only)
holdGlobalArgumentsnow also holds an array made for the call: a new array (CreateArray,NewArray,NewEmptyArray), or a constant array copied to the heap by its cast, whose only use is the call (through casts). It is retained where it is made and released after the call, using the same mechanism as the global hold (#647), including the #645 unwind slot. That release also gives the array back.Tests
tests/00array_argument_held.tscovers:pushin the finallyIt runs compiled, under JIT, and in the rc/none corpus, and it crashes under rc on main on Linux.
Verification
ctest -C Release: Windows 4982/4982, WSL Linux 4964/4964.mm_fuzz.py --jobs 10 run --count 500 --seed 1: only the 3 known own failures (R1, O4).🤖 Generated with Claude Code