GeorgiaPreda opened a new pull request, #55303:
URL: https://github.com/apache/arrow/pull/55303

   ### 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?
   - Copy String and GLib::Bytes inputs into native-owned Arrow buffer storage.
   - Remove the redundant Ruby constructor-argument GC guard for Buffer.
   - Add regression tests covering garbage collection with chunked arrays and 
slices, and mutation of the original String.
   
   ### Are these changes tested?
   
   The corruption was reproduced before the fix. After the fix:
   - 1,800 selected Ruby tests passed.
   - 36 GLib buffer and stream tests passed.
   - RuboCop, Ruby syntax checks, and git diff --check passed.
   
   ### 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:**
   
   - [] Human
   - [x] AI
   
   **Reviewed before submission by:**
   
   - [x] Human
   - [ ] AI
   - [ ] Not reviewed
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to