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 25, 2023
1 parent 1c44dd1 commit 89d31b8
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 @@ -639,7 +639,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 89d31b8

Please sign in to comment.