Skip to content

Bitmap Length Validation is Incorrect #1231

Closed

Description

@tustvold

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

Activity

  1. added
    bug
    on Jan 23, 2022
  2. added a commit that references this issue on Jan 24, 2022
  3. added
    arrow
    on Jan 24, 2022
  4. changed the title [-]Bitmap Length Validation is Incorrect[/-] [+]`Bitmap` Length Validation is Incorrect[/+] on Feb 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    arrowbugsecurity

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions