Add proptest fuzzing to parquet-variant and implement fixes for findings#10352
Open
cetra3 wants to merge 2 commits into
Open
Add proptest fuzzing to parquet-variant and implement fixes for findings#10352cetra3 wants to merge 2 commits into
proptest fuzzing to parquet-variant and implement fixes for findings#10352cetra3 wants to merge 2 commits into
Conversation
klion26
approved these changes
Jul 17, 2026
| use std::collections::HashSet; | ||
|
|
||
| /// The empty metadata dictionary. | ||
| const EMPTY_METADATA: &[u8] = &[1, 0, 0]; |
Member
There was a problem hiding this comment.
we can reuse the EMPTY_VARIANT_METADATA_BYTES in variant/metdata.rs
| } | ||
| } else { | ||
| // The metadata dictionary can't guarantee uniqueness or sortedness, so we have to parse out the corresponding field names | ||
| // to check lexicographical order |
Member
There was a problem hiding this comment.
Do we need to update the doc here to respect the uniqueness?
| let mut current_offset = offsets.next().unwrap_or(0); | ||
| for next_offset in offsets { | ||
| value_buffer | ||
| .get(current_offset..next_offset) |
Member
There was a problem hiding this comment.
I'm curious about the cause of the offset not land on UTF-8 character boundaries. is the data corrupt or the writer did not write the right data?
Contributor
Author
There was a problem hiding this comment.
Yeah this is to guard against corrupt data. I don't think there is a way to construct this shape of data with VariantBuilder but you can easily craft corrupted bytes that will hit a panic.
This is the same check as the other branch makes a handful of lines above, so nothing new here.
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?
This PR is not tied to a single pre-existing issue; it fixes findings 1-6 in the table below,
all found while adding the
proptestharness. The two remaining findings are out of scope hereand are tracked as follow-up issues:
shred_variantpanics on an object with duplicate field names (finding 7)PartialEqon unvalidated deeply-nested variants overflows the stack (finding 8)Here's a list of bugs found:
metadata.rs:317metadata.rs(same branch)object.rs:270decode_dateoverflows on large day countsdecoder.rs:281try_newdecode_uuidindexes raw on a truncated payloaddecoder.rs:347try_newlist.rs:234,object.rsshred_variantdouble-appends on duplicate field namesshred_variant.rs:418-429PartialEqrecurses without bound on shallow variantslist.rs:313,object.rsRationale for this change
This PR was raised after some bugs caught in production caused some failing jobs.
The original bug was empty field strings caused a weird
offsets not monotonically increasing, but with the assistance of an agent, we expanded our search to useproptestto find some other similar cases.What changes are included in this PR?
Adds a new
proptestharness forparquet-variantand fixesAre these changes tested?
Yes, most of these changes are driven by failing proptests and converted into smaller unit tests.
Are there any user-facing changes?
The only one that is probably worth mentioning, and maybe something we allow to be configured, is a max depth recursion constant was added.