Skip to content

Commit

Permalink
Check binary array length when applying truncate
Browse files Browse the repository at this point in the history
  • Loading branch information
Fokko committed Feb 21, 2025
1 parent 6fbeb32 commit 3b875e9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion crates/iceberg/src/transform/truncate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ impl Truncate {

#[inline]
fn truncate_binary(s: &[u8], width: usize) -> &[u8] {
&s[0..width]
if s.len() > width {
&s[0..width]
} else {
&s
}
}

#[inline]
Expand Down

0 comments on commit 3b875e9

Please sign in to comment.