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

PrimitiveBuilder::finish_dict does not validate dictionary offsets #1978

Closed
tustvold opened this issue Jun 30, 2022 · 0 comments · Fixed by #1980
Closed

PrimitiveBuilder::finish_dict does not validate dictionary offsets #1978

tustvold opened this issue Jun 30, 2022 · 0 comments · Fixed by #1980
Assignees
Labels
arrow Changes to the arrow crate bug security

Comments

@tustvold
Copy link
Contributor

Describe the bug

PrimitiveBuilder::finish_dict does not validate that the provided values array contains enough values for the largest key in the dictionary

To Reproduce

#[test]
fn test_primitive_array_builder_dict() {
    let mut builder = Int32Array::builder(10);
    builder.append_value(1).unwrap();

    let values = Arc::new(Int32Array::from_iter_values([0]));
    let dict = builder.finish_dict(values);
}

Expected behavior

It should not be possible to construct invalid ArrayData with safe APIs

@tustvold tustvold added the bug label Jun 30, 2022
@tustvold tustvold self-assigned this Jun 30, 2022
tustvold added a commit to tustvold/arrow-rs that referenced this issue Jun 30, 2022
@alamb alamb changed the title PrimitiveBuilder::finish_dict does not validate dictionary offsets PrimitiveBuilder::finish_dict does not validate dictionary offsets Jul 7, 2022
@alamb alamb added arrow Changes to the arrow crate security labels Jul 7, 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