mirror of
https://gitee.com/openharmony/third_party_rust_nom
synced 2024-11-26 17:20:29 +00:00
fix other uses of MAX_INITIAL_CAPACITY_BYTES
fix panic when the output type is zero sized
This commit is contained in:
parent
ee7ad17086
commit
a534b39078
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user