Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

fix oob if in .get #1529

Merged
merged 4 commits into from
Aug 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/array/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,18 @@ pub trait Array: Send + Sync + dyn_clone::DynClone + 'static {
/// Panics iff `i >= self.len()`.
#[inline]
fn is_null(&self, i: usize) -> bool {
assert!(i < self.len());
unsafe { self.is_null_unchecked(i) }
}

/// Returns whether slot `i` is null.
/// # Safety
/// The caller must ensure `i < self.len()`
#[inline]
unsafe fn is_null_unchecked(&self, i: usize) -> bool {
self.validity()
.as_ref()
.map(|x| !x.get_bit(i))
.map(|x| !x.get_bit_unchecked(i))
.unwrap_or(false)
}

Expand Down
2 changes: 1 addition & 1 deletion src/io/ipc/read/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@
let start = reader.stream_position()?;
reader.read_exact(&mut magic_buffer)?;
if magic_buffer != ARROW_MAGIC_V2 {
if &magic_buffer[..4] == ARROW_MAGIC_V1 {
if magic_buffer[..4] == ARROW_MAGIC_V1 {

Check warning on line 219 in src/io/ipc/read/file.rs

View check run for this annotation

Codecov / codecov/patch

src/io/ipc/read/file.rs#L219

Added line #L219 was not covered by tests
return Err(Error::NotYetImplemented("feather v1 not supported".into()));
}
return Err(Error::from(OutOfSpecKind::InvalidHeader));
Expand Down
Loading