fix(mysql2): fold the JSON array arm so no local spans a nested conversion - #9352
Merged
Conversation
added 2 commits
September 1, 2026 05:38
…rsion json_value_to_jsvalue recurses, so the array pointer was read as an argument before a call that can allocate and move it. The fold keeps the file at its unrooted-local ceiling of 9.
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.
Follow-up to #9350, which takes
perry-ext-mysql2to 10 unrooted-local findings against its ceiling of 9.The new
json_value_to_jsvaluedecoder recurses, and its array arm was:Rust evaluates
arrbefore the recursive call, and that call allocates — so a collection inside it leaves the already-read pointer stale. That is the #8217 shape rather than a checker artifact, and the recursion makes it likelier to actually happen than in the flat row builders.Folding removes the named local, which is what the row and field builders alongside it already do, and returns the file to its ceiling with no baseline change.
Worth saying plainly: this reduces the window, it does not eliminate the exposure.
perry-ext-mysql2deliberately depends onperry-ffionly —perry-runtimeis a dev-dependency, so there is noRuntimeHandleScopeavailable in its production code — and building any nested JS structure without roots keeps a live JS pointer across allocations somewhere. Every builder in this crate has that property today and is carried as accepted debt. The fold matches existing practice; it is not a claim that the crate is rooting-safe. Giving these builders real roots would need the crate to take aperry-runtimedependency, which is a design decision beyond this fix.Validation:
perry-runtime --lib2905/0 andperry-ext-mysql2green underRUST_TEST_THREADS=1; release build clean with no warnings; file-size, raw-handle, unrooted-local (--check,--self-test,--no-raise-vs), root-holder, shape-census and fmt gates all pass with no baseline touched.