Skip to content

Commit

Permalink
Fix integer overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
fintelia committed Dec 22, 2023
1 parent 1f718a2 commit a41a5d6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lossless.rs
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,8 @@ impl HuffmanInfo {
if self.bits == 0 {
return 0;
}
let position = usize::from((y >> self.bits) * self.xsize + (x >> self.bits));
let position =
usize::from(y >> self.bits) * usize::from(self.xsize) + usize::from(x >> self.bits);
let meta_huff_code: usize = self.image[position].try_into().unwrap();
meta_huff_code
}
Expand Down

0 comments on commit a41a5d6

Please sign in to comment.