Repository navigation
fix(arrow-array): strip trailing bytes in FixedSizeBinaryBuilder::append_array (#12409) - #12437
ToniAdreal wants to merge 1 commit into
Conversation
|
what problem is this fixing? it requires a consumer construct an invalid array via |
|
You're right that after #12410 the checked paths can't produce this anymore — I re-read The reason I still opened it is that #12409 — the issue this PR links to — explicitly called out What the guard buys in practice: If you'd rather treat |
|
this reads like an LLM, im closing this. |
Follow-up to #12410, which fixed the construction-time leak for #12409.
#12410 strips trailing bytes in
FixedSizeBinaryArray::try_new_with_len, so the checked constructors no longer expose them. One path is still open:FixedSizeBinaryArray::new_uncheckedstores the buffer as-is (unlessforce_validate), andFixedSizeBinaryBuilder::append_arraycopiedvalue_data()wholesale — the issue itself calls out this exact spot. An unchecked array carrying trailing bytes could still pollute the builder and shift every element appended afterwards.Changes:
FixedSizeBinaryBuilder::append_arraynow copies onlylen * value_sizebytes before extending.test_fixed_size_binary_builder_append_array_unchecked_trailing_bytes: appending an unchecked 10-byte array (value_size 3) asserts the builder holds 9 bytes and the finished array reports 9. (Named with anuncheckedinfix to avoid colliding with thetest_fixed_size_binary_builder_append_array_trailing_bytestest added in fix(arrow-array): strip trailing bytes in values data when constructingFixedSizeBinaryArrays #12410, which covers the checked path.)Verification:
values_slice().len()was 10, expected 9) and passes after.cargo test -p arrow-array --lib fixed_size_binary: 45 passed, 0 failed.cargo test -p arrow-array --lib: 765 passed, 0 failed, 1 ignored, 1 filtered out. The filtered test istest_gc_huge_array, which the 6 GB dev cell OOM-kills (SIGKILL, unrelated to this change); CI should run it.cargo clippy -p arrow-array: clean, no warnings.cargo fmt --all -- --check: clean.AI assistance disclosure: This PR was prepared with AI assistance (Muse). I reviewed the diff line by line, I understand the change, and I ran the tests listed above.