Repository navigation
GH-54688: [Ruby] Keep buffer data alive after Ruby wrappers are collected - #55303
Open
GeorgiaPreda wants to merge 1 commit into
Open
GeorgiaPreda wants to merge 1 commit into
GeorgiaPreda wants to merge 1 commit into
Conversation
Copy String and GLib::Bytes inputs into native-owned Arrow buffers. Remove the redundant Ruby input guard and add array and slice GC regressions. Fixes apache#54688
|
|
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.
Rationale for this change
Fixes #54688. A Ruby buffer’s input can be garbage-collected while an array still references its native storage, causing subsequent reads to return corrupted values.
What changes are included in this PR?
Are these changes tested?
The corruption was reproduced before the fix. After the fix:
Are there any user-facing changes?
Buffer contents remain valid when arrays outlive their Ruby wrappers. Constructing a buffer from a String or GLib::Bytes now copies the data into native-owned storage. Subsequent mutations to the original String no longer change the buffer’s contents.
This PR contains a "Critical Fix". It prevents corrupted array values caused by accessing input storage after Ruby garbage collection.
Was AI used for this PR?
PR code and description written by:
Reviewed before submission by: