-
Notifications
You must be signed in to change notification settings - Fork 847
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
Copying inappropriately aligned buffer in ipc reader #2883
Changes from 1 commit
aba2874
e184bad
705aefa
d2ccba5
400cf81
6a56057
30ffb5c
5dc264a
1538455
96577a6
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 |
---|---|---|
|
@@ -878,6 +878,7 @@ mod tests { | |
assert_eq!(array.len(), 2); | ||
assert_eq!(array.value(0), 0); | ||
assert_eq!(array.value(1), 0); | ||
assert_eq!(array.values(), &[0, 0]); | ||
|
||
// Not aligned. | ||
// `ArrayData::build` checks buffer length. | ||
|
@@ -889,6 +890,7 @@ mod tests { | |
let array = Int32Array::from(array_data); | ||
assert_eq!(array.len(), 1); | ||
assert_eq!(array.value(0), 0); | ||
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. This is now UB, as this violates the safety requirement in PrimitiveArray::values. I'm not sure why MIRI isn't catching this... Edit: |
||
assert_eq!(array.values(), &[0]); | ||
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. For https://github.com/apache/arrow-rs/pull/2883/files#r996382807, I think you mean here? |
||
|
||
ArrayData::builder(DataType::Int32) | ||
.add_buffer(buf2) | ||
|
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.
You need to call array.values() on the unaligned PrimitiveArray