From a534b390788477be0115ae1699097d07f5c8ab35 Mon Sep 17 00:00:00 2001 From: Geoffroy Couprie Date: Sun, 15 Jan 2023 20:15:00 +0100 Subject: [PATCH] fix other uses of MAX_INITIAL_CAPACITY_BYTES fix panic when the output type is zero sized --- src/multi/mod.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/multi/mod.rs b/src/multi/mod.rs index 0a7e1f3..7312908 100644 --- a/src/multi/mod.rs +++ b/src/multi/mod.rs @@ -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::(); + let max_initial_capacity = + MAX_INITIAL_CAPACITY_BYTES / crate::lib::std::mem::size_of::().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();