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

Commit

Permalink
Removed last assert from IPC read (#748)
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgecarleitao authored Jan 10, 2022
1 parent 4c29966 commit 3f6d522
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/io/ipc/read/read_basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,15 @@ fn read_uncompressed_bitmap<R: Read + Seek>(
bytes: usize,
reader: &mut R,
) -> Result<Vec<u8>> {
// something is wrong if we can't `length`
assert!(length <= bytes * 8);
if length > bytes * 8 {
return Err(ArrowError::OutOfSpec(format!(
"An array requires a bitmap with at least the same number of bits as slots. \
However, this array reports {} slots but the the bitmap in IPC only contains \
{} bits",
length,
bytes * 8,
)));
}
// it is undefined behavior to call read_exact on un-initialized, https://doc.rust-lang.org/std/io/trait.Read.html#tymethod.read
// see also https://github.com/MaikKlein/ash/issues/354#issue-781730580
let mut buffer = vec![0; bytes];
Expand Down

0 comments on commit 3f6d522

Please sign in to comment.