Repository navigation
fix: UnionFields::from_iter should validate input - #11533
Merged
Merged
Conversation
Jefffrey
commented
Oct 13, 2026
| Self(iter.into_iter().collect()) | ||
| let iter = iter.into_iter(); | ||
| let (type_ids, fields): (Vec<i8>, Vec<FieldRef>) = iter.unzip(); | ||
| Self::try_new(type_ids, fields).expect("invalid arguments passed") |
Contributor
Author
There was a problem hiding this comment.
unfortunate that it introduces a panic, but this is better than letting in invalid data
Jefffrey
commented
Oct 13, 2026
| /// - All type ids are unique | ||
| /// - All type ids are non-negative | ||
| #[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] | ||
| #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] |
Contributor
Author
There was a problem hiding this comment.
identified by codex review, but having these serde derives still allows a loophole; i dont know the impact of removing them (if even possible)
Contributor
Author
There was a problem hiding this comment.
alamb
approved these changes
Oct 13, 2026
Contributor
Author
|
thanks @alamb |
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Oct 14, 2026
Contributor
|
CI failure should be fixed via |
etseidl
pushed a commit
to etseidl/arrow-rs
that referenced
this pull request
Oct 15, 2026
…he#11562) # Which issue does this PR close? N/A # Rationale for this change The `audit` CI job is failing on main and on PRs (for example https://github.com/apache/arrow-rs/actions/runs/38600959284/job/116002272430 on apache#11533) because four new RustSec advisories were published today against `rustls`: - [RUSTSEC-2026-0346](https://rustsec.org/advisories/RUSTSEC-2026-0346): `Debug` impls for client session values expose TLS secrets - [RUSTSEC-2026-0347](https://rustsec.org/advisories/RUSTSEC-2026-0347): Buffered application data sent to outer server after ECH rejection - [RUSTSEC-2026-0348](https://rustsec.org/advisories/RUSTSEC-2026-0348): Brotli certificate decompression can allocate up to 1 GiB before authentication - [RUSTSEC-2026-0349](https://rustsec.org/advisories/RUSTSEC-2026-0349): Unauthenticated ServerHello can downgrade later connections to classical key exchange All four are fixed in `rustls` 0.23.46. # What changes are included in this PR? `cargo update -p rustls`, which bumps `rustls` from 0.23.45 to 0.23.46 in `Cargo.lock`. No other changes. # Are these changes tested? I reproduced the failure locally with `cargo audit` on current main (same four advisories), and confirmed `cargo audit` passes after this change. # Are there any user-facing changes? No Co-authored-by: Claude Fable 5.1 <[email protected]>
This was referenced Oct 15, 2026
Seanium
pushed a commit
to Seanium/arrow-rs
that referenced
this pull request
Oct 18, 2026
…11638) # Which issue does this PR close? - Closes apache#11576. # Rationale for this change `UnionFields` derived `Deserialize`, so deserializing could build a value with duplicate or negative type ids, skipping the checks that apache#11533 added to the other constructors. # What changes are included in this PR? `Serialize` is still derived (transparent), but `Deserialize` is now implemented by hand: it reads the same sequence of `(type_id, field)` pairs and builds the value with `UnionFields::try_new`, returning a serde error if validation fails. The wire format doesn't change, so anything serialized before still deserializes as long as it was valid. I kept serde rather than removing it, since `DataType` (and therefore `Field` and `Schema`) derive serde and need `UnionFields` to support it. # Are these changes tested? Yes, two new tests in `fields.rs` (behind the `serde` feature, using `postcard` like the existing `Field` serde tests): a round trip of a valid `UnionFields`, and deserializing input with a duplicate type id and with a negative type id, both of which now fail. The second test fails without this change. # Are there any significant user-facing changes? Deserializing an invalid `UnionFields` (or a `DataType::Union` containing one) now returns an error instead of succeeding. AI disclosure: I used an AI coding assistant to write the change, the tests and this description, and I reviewed all of it. --------- Co-authored-by: ump45nose <[email protected]>
This was referenced Oct 18, 2026
alamb
added a commit
that referenced
this pull request
Oct 21, 2026
…11726) - Backport #11533 - For inclusion in #11666 Cherry-pick of b2e2c2d Co-authored-by: Jeffrey Vo <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Rationale for this change
Make it impossible to create an invalid
UnionFieldsvia safe APIs. This makes it easier for downstream uses ofUnionFields(in other parts of the codebase), since they can rely on the data being valid, instead of needing to check each time.What changes are included in this PR?
Make sure
UnionFields::from_itervalidates its input before construction aUnionFields, similar toUnionFields::try_newAre these changes tested?
Added new unit test.
Are there any significant user-facing changes?
UnionFields::from_itercan now panic on invalid input data. This can be reachable via acollect()into aUnionFieldsfor example.