Skip to content

FixedSizeBinaryBuilder::append_value accepts values whose length differs from value_length by a multiple of 2^32 #12285

Closed

Description

@mbutrovich

Describe the bug

FixedSizeBinaryBuilder::append_value compares self.value_length != value.as_ref().len() as i32 (fixed_size_binary_builder.rs). The as i32 cast truncates, so a slice whose length is value_length + k * 2^32 passes the check. The builder then appends every byte of it but counts one value. Later values read from the wrong position, and value_data() is longer than len * value_length, which violates the FixedSizeBinaryArray::new_unchecked contract that finish relies on. With force_validate, finish panics instead.

To Reproduce

This needs about 8 GiB of memory.

let mut b = FixedSizeBinaryBuilder::new(1);
let big = vec![0u8; (1usize << 32) + 1];
assert!(b.append_value(&big).is_err()); // currently Ok

Expected behavior

append_value should return an error for any slice whose length isn't value_length. Comparing as usize fixes it: value.as_ref().len() != self.value_length as usize. with_capacity already asserts value_length >= 0, so the cast is lossless.

Activity

  1. Surajsuthar commented on Nov 17, 2026

    @Surajsuthar
    Contributor

    take

  2. added a commit that references this issue on Nov 19, 2026
    d64e6f0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions