Skip to content

Commit 6d153e0

Browse files
author
Nicklas Warming Jacobsen
committed
Fix bug in unseal_all where it will panic if there is no protected_attributes
1 parent 6430891 commit 6d153e0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/crypto/sealed.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,13 @@ impl SealedTableEntry {
109109
}
110110

111111
let decrypted = async_map_somes(decryptable_items, |items| cipher.decrypt(items)).await?;
112-
let mut chunks_exact = decrypted.chunks_exact(protected_attributes.len());
113112
let mut default_iter =
114113
std::iter::repeat_with::<&[Option<Plaintext>], _>(|| &[]).take(plaintext_items.len());
115114

115+
let mut chunks_exact;
116116
let decrypted_iter: &mut dyn Iterator<Item = &[Option<Plaintext>]> =
117117
if protected_attributes.len() > 0 {
118+
chunks_exact = decrypted.chunks_exact(protected_attributes.len());
118119
&mut chunks_exact
119120
} else {
120121
&mut default_iter

0 commit comments

Comments
 (0)