You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "kou (via GitHub)" <gi...@apache.org> on 2025/01/07 06:30:46 UTC
[I] [Ruby] Ensure initializing all `rb_memory_view_t` members [arrow]
kou opened a new issue, #45187:
URL: https://github.com/apache/arrow/issues/45187
### Describe the enhancement requested
`rb_memory_view_get()` caller may not pass zero-cleared `rb_memory_view_t`.
### Component(s)
Ruby
--
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: issues-unsubscribe@arrow.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Ruby] Ensure initializing all `rb_memory_view_t` members [arrow]
Posted by "kou (via GitHub)" <gi...@apache.org>.
kou closed issue #45187: [Ruby] Ensure initializing all `rb_memory_view_t` members
URL: https://github.com/apache/arrow/issues/45187
--
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: issues-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Ruby] Ensure initializing all `rb_memory_view_t` members [arrow]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #45187:
URL: https://github.com/apache/arrow/issues/45187#issuecomment-4415172192
This issue has been marked as stale because it has had no activity in the past 365 days. Please remove the stale label or comment below, or this issue will be closed in 14 days. If this improvement is still desired but has no current owner, please add the 'Status: needs champion' label.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Ruby] Ensure initializing all `rb_memory_view_t` members [arrow]
Posted by "kou (via GitHub)" <gi...@apache.org>.
kou commented on issue #45187:
URL: https://github.com/apache/arrow/issues/45187#issuecomment-4786067831
@Reranko05 Could you add "take" comment here?
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Ruby] Ensure initializing all `rb_memory_view_t` members [arrow]
Posted by "himotoyoshi (via GitHub)" <gi...@apache.org>.
himotoyoshi commented on issue #45187:
URL: https://github.com/apache/arrow/issues/45187#issuecomment-4447196323
Hit this in practice on red-arrow 24.0.0 / ruby 3.4.1 / arm64-darwin24.
A C-extension consumer that stack-allocates `rb_memory_view_t view;`
sends the uninitialised `view.item_desc.components` straight into the
unconditional `xfree` at the end of `rb_memory_view_release`, and
libmalloc aborts the process. Current `main` is still affected
(`primitive_array_get` and `buffer_get` in `ext/arrow/memory-view.cpp`
do not initialise the `item_desc` fields).
### Fix
Two lines in each of `primitive_array_get` (line 220 on main) and
`buffer_get` (line 247 on main):
```cpp
view_->item_desc.components = NULL;
view_->item_desc.length = 0;
```
### Reproduction (stdlib + red-arrow only)
```ruby
require "arrow"
# Bind rb_memory_view_get / rb_memory_view_release through Fiddle (FFI).
require "fiddle"
libruby = Fiddle.dlopen(nil)
rb_memory_view_get = Fiddle::Function.new(libruby["rb_memory_view_get"],
[Fiddle::TYPE_UINTPTR_T, Fiddle::TYPE_VOIDP, Fiddle::TYPE_INT],
Fiddle::TYPE_INT)
rb_memory_view_release = Fiddle::Function.new(libruby["rb_memory_view_release"],
[Fiddle::TYPE_VOIDP],
Fiddle::TYPE_INT)
# Allocate a buffer for rb_memory_view_t and fill it with non-zero
# garbage, mimicking an uninitialised stack-allocated struct.
view = Fiddle::Pointer.malloc(256)
256.times { |i| view[i] = 0xAA }
# Acquire and release a MemoryView on an Arrow::Int32Array.
arr = Arrow::Int32Array.new([1, 2, 3, 4, 5])
rb_memory_view_get.call(Fiddle.dlwrap(arr), view, 0)
rb_memory_view_release.call(view)
# ruby(...) malloc: *** error for object 0xaaaaaaaaaaaaaaaa:
# pointer being freed was not allocated
# Abort trap: 6
```
Replacing `0xAA` with `0` makes the same script complete cleanly,
confirming the abort is driven entirely by what value
`item_desc.components` happens to hold.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Ruby] Ensure initializing all `rb_memory_view_t` members [arrow]
Posted by "kou (via GitHub)" <gi...@apache.org>.
kou commented on issue #45187:
URL: https://github.com/apache/arrow/issues/45187#issuecomment-4786066836
Issue resolved by pull request 50234
https://github.com/apache/arrow/pull/50234
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Ruby] Ensure initializing all `rb_memory_view_t` members [arrow]
Posted by "Reranko05 (via GitHub)" <gi...@apache.org>.
Reranko05 commented on issue #45187:
URL: https://github.com/apache/arrow/issues/45187#issuecomment-4786082063
take
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org