Skip to content

Commit

Permalink
fix other uses of MAX_INITIAL_CAPACITY_BYTES
Browse files Browse the repository at this point in the history
fix  panic when the output type is zero sized
  • Loading branch information
Geal committed Jan 15, 2023
1 parent ee7ad17 commit a534b39
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/multi/mod.rs
Expand Up @@ -392,7 +392,8 @@ where
return Err(Err::Failure(E::from_error_kind(input, ErrorKind::ManyMN)));
}

let max_initial_capacity = MAX_INITIAL_CAPACITY_BYTES / crate::lib::std::mem::size_of::<O>();
let max_initial_capacity =
MAX_INITIAL_CAPACITY_BYTES / crate::lib::std::mem::size_of::<O>().max(1);
let mut res = crate::lib::std::vec::Vec::with_capacity(min.min(max_initial_capacity));
for count in 0..max {
let len = input.input_len();
Expand Down

0 comments on commit a534b39

Please sign in to comment.