Skip to content

Commit 0de66ad

Browse files
authored
Fix unsoundness with block size equal to zero (#1277)
1 parent 48517bc commit 0de66ad

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

cipher/src/stream_wrapper.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ where
4747
#[inline]
4848
fn get_pos(&self) -> usize {
4949
let pos = self.pos as usize;
50+
if T::BlockSize::USIZE == 0 {
51+
panic!("Block size can not be equal to zero");
52+
}
5053
if pos >= T::BlockSize::USIZE {
5154
debug_assert!(false);
5255
// SAFETY: `pos` is set only to values smaller than block size

0 commit comments

Comments
 (0)