-
Notifications
You must be signed in to change notification settings - Fork 4k
GH-46704: [C++] Fix OSS-Fuzz build failure #46706
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -329,15 +329,24 @@ class RecordBatchSerializer { | |
| return Status::OK(); | ||
| } | ||
|
|
||
| int64_t required_bytes = sizeof(offset_type) * (array.length() + 1); | ||
| if (array.value_offset(0) > 0) { | ||
| const int64_t required_bytes = sizeof(offset_type) * (array.length() + 1); | ||
|
|
||
| offset_type first_offset = 0; | ||
| RETURN_NOT_OK(MemoryManager::CopyBufferSliceToCPU( | ||
| array.data()->buffers[1], array.offset() * sizeof(offset_type), | ||
| sizeof(offset_type), reinterpret_cast<uint8_t*>(&first_offset))); | ||
|
|
||
| if (first_offset > 0) { | ||
| // If the offset of the first value is non-zero, then we must create a new | ||
| // offsets buffer with shifted offsets. | ||
| if (!array.data()->buffers[1]->is_cpu()) { | ||
| return Status::NotImplemented("Rebasing non-CPU offsets"); | ||
| } | ||
kou marked this conversation as resolved.
Show resolved
Hide resolved
Comment on lines
+342
to
+344
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Two questions:
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've opened #46747 for this. |
||
| ARROW_ASSIGN_OR_RAISE(auto shifted_offsets, | ||
| AllocateBuffer(required_bytes, options_.memory_pool)); | ||
|
|
||
| auto dest_offsets = shifted_offsets->mutable_span_as<offset_type>(); | ||
| const offset_type* source_offsets = array.raw_value_offsets(); | ||
| auto dest_offsets = shifted_offsets->mutable_span_as<offset_type>(); | ||
| const offset_type start_offset = source_offsets[0]; | ||
|
|
||
| for (int i = 0; i <= array.length(); ++i) { | ||
|
|
@@ -369,6 +378,9 @@ class RecordBatchSerializer { | |
| // If we have a non-zero offset, it's likely that the smallest offset is | ||
| // not zero. We must a) create a new offsets array with shifted offsets and | ||
| // b) slice the values array accordingly. | ||
| if (!array.data()->buffers[1]->is_cpu()) { | ||
| return Status::NotImplemented("Rebasing non-CPU list view offsets"); | ||
| } | ||
|
|
||
| ARROW_ASSIGN_OR_RAISE(auto shifted_offsets, | ||
| AllocateBuffer(required_bytes, options_.memory_pool)); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'll need some context here. Is this function supposed to be able to deal with non-CPU arrays? Does this rule apply to other functions in this source file too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's supposed to.