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

Avoid infinite loop in bad parquet by checking the number of rep levels #6232

Merged
merged 3 commits into from
Aug 15, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions parquet/src/column/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,12 @@ where
let (mut records_read, levels_read) =
reader.read_rep_levels(out, remaining_records, remaining_levels)?;

if levels_read == 0 {
// Tha fact that we're still looping implies there must be some levels to read.
jp0317 marked this conversation as resolved.
Show resolved Hide resolved
return Err(general_err!(
"Insufficient repetition levels read from column"
));
}
if levels_read == remaining_levels && self.has_record_delimiter {
// Reached end of page, which implies records_read < remaining_records
// as otherwise would have stopped reading before reaching the end
Expand Down
Loading