Skip to content

Commit

Permalink
return error for invalid decimal length
Browse files Browse the repository at this point in the history
  • Loading branch information
jp0317 committed Dec 19, 2024
1 parent 55f3f64 commit 2597c9a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion parquet/src/schema/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,10 @@ impl<'a> PrimitiveTypeBuilder<'a> {
}
}
PhysicalType::FIXED_LEN_BYTE_ARRAY => {
let length = self.length.checked_mul(8).unwrap_or(i32::MAX);
let length = self
.length
.checked_mul(8)
.ok_or(general_err!("Invalid length {} for Decimal", self.length))?;
let max_precision = (2f64.powi(length - 1) - 1f64).log10().floor() as i32;

if self.precision > max_precision {
Expand Down

0 comments on commit 2597c9a

Please sign in to comment.