This is an automated email from the ASF dual-hosted git repository.
alamb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git
The following commit(s) were added to refs/heads/master by this push:
new 0375e81 Fix null bitmap length validation (#1231) (#1232)
0375e81 is described below
commit 0375e81d5e59933ca7779676d0394d6b0183f80c
Author: Raphael Taylor-Davies <[email protected]>
AuthorDate: Mon Jan 24 21:31:23 2022 +0000
Fix null bitmap length validation (#1231) (#1232)
* Fix null bitmap length validation (#1231)
* Reuse existing test
---
arrow/src/array/data.rs | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/arrow/src/array/data.rs b/arrow/src/array/data.rs
index 2f76a12..02d9efb 100644
--- a/arrow/src/array/data.rs
+++ b/arrow/src/array/data.rs
@@ -650,7 +650,8 @@ impl ArrayData {
}
// check null bit buffer size
- if let Some(null_bit_buffer) = self.null_bitmap.as_ref() {
+ if let Some(null_bit_map) = self.null_bitmap.as_ref() {
+ let null_bit_buffer = null_bit_map.buffer_ref();
let needed_len = bit_util::ceil(len_plus_offset, 8);
if null_bit_buffer.len() < needed_len {
return Err(ArrowError::InvalidArgumentError(format!(
@@ -1695,14 +1696,14 @@ mod tests {
}
#[test]
- #[should_panic(expected = "null_bit_buffer size too small. got 8 needed
13")]
+ #[should_panic(expected = "null_bit_buffer size too small. got 1 needed
2")]
fn test_bitmap_too_small() {
- let buffer = make_i32_buffer(100);
+ let buffer = make_i32_buffer(9);
let null_bit_buffer = Buffer::from(vec![0b11111111]);
ArrayData::try_new(
DataType::Int32,
- 100,
+ 9,
Some(0),
Some(null_bit_buffer),
0,