Skip to content
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

Bitmap Length Validation is Incorrect #1231

Closed
tustvold opened this issue Jan 23, 2022 · 0 comments · Fixed by #1232
Closed

Bitmap Length Validation is Incorrect #1231

tustvold opened this issue Jan 23, 2022 · 0 comments · Fixed by #1232
Labels
arrow Changes to the arrow crate bug security

Comments

@tustvold
Copy link
Contributor

tustvold commented Jan 23, 2022

Describe the bug

Noticed whilst testing #1230, the bitmask length validation confuses byte length and bit length.

This will allow bitmasks that are too short to pass ArrayData::try_new validation

To Reproduce

#[test]
    fn test_validate_bitmask_length() {
        let data = MutableBuffer::from_len_zeroed(9 * 4).into();
        let nulls = MutableBuffer::new_null(1).into();

        let err = ArrayData::try_new(
            DataType::Int32,
            9,
            Some(9),
            Some(nulls),
            0,
            vec![data],
            vec![],
        )
        .unwrap_err()
        .to_string();

        assert!(
            err.contains("null_bit_buffer size too small. got 1 needed 2"),
            "{}",
            err
        )
    }

Expected behavior

The above test should pass

@tustvold tustvold added the bug label Jan 23, 2022
tustvold added a commit to tustvold/arrow-rs that referenced this issue Jan 23, 2022
alamb pushed a commit that referenced this issue Jan 24, 2022
* Fix null bitmap length validation (#1231)

* Reuse existing test
@alamb alamb added arrow Changes to the arrow crate security labels Jan 24, 2022
@alamb alamb changed the title Bitmap Length Validation is Incorrect Bitmap Length Validation is Incorrect Feb 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrow Changes to the arrow crate bug security
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants