GH-45187: [Ruby] Ensure initializing all rb_memory_view_t members#50234
Conversation
|
|
|
@kou The lint failure appears unrelated to this PR. It was caused by a ShellCheck Docker image pull issue. The same |
19e6c5c to
bd83fad
Compare
|
@kou Thanks for the review. Addressed all review comments.
|
|
@kou One question about the regression tests: I added the Would you prefer keeping the tests as they are now, or removing them entirely? |
kou
left a comment
There was a problem hiding this comment.
I prefered not adding tests for this at all in the first review because I feel that we don't want to maintain these tests. But I'm OK with adding them now because they are organized now.
bd83fad to
1c5ad91
Compare
@kou Thanks for the clarification. |
|
@kou Thanks for the review. All CI checks have completed successfully now. |
|
After merging your PR, Conbench analyzed the 4 benchmarking runs that have been run so far on merge-commit 12b3eda. There were no benchmark performance regressions. 🎉 The full Conbench report has more details. It also includes information about 8 possible false positives for unstable benchmarks that are known to sometimes produce them. |
Rationale for this change
rb_memory_view_get()callers may pass a non-zero-initializedrb_memory_view_t.primitive_array_get()andbuffer_get()did not initializeitem_desc.componentsanditem_desc.length, which could causerb_memory_view_release()to attempt to free an invalid pointer and abort the process.What changes are included in this PR?
This change initializes
item_desc.componentsanditem_desc.lengthin bothprimitive_array_get()andbuffer_get().It also adds regression tests that verify releasing a memory view with a non-zero-initialized
rb_memory_view_tdoes not crash for bothArrow::Int32ArrayandArrow::Buffer.Are these changes tested?
Yes. Added regression tests in
test-memory-view.rbthat reproduced the crash before this change and pass after the fix.Are there any user-facing changes?
No.
This PR contains a "Critical Fix".
This change fixes a crash that could occur when
rb_memory_view_release()is called with a memory view whoseitem_descmembers were not initialized.rb_memory_view_tmembers #45187