fix other uses of MAX_INITIAL_CAPACITY_BYTES
fix  panic when the output typ is zero sized
@@ -398,7 +398,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();
@@ -1097,7 +1098,8 @@ where
return Err(Err::Failure(E::from_error_kind(input, ErrorKind::Many)));
}
- 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(capacity.min(max_initial_capacity));
for count in range.bounded_iter() {
