mirror of
https://github.com/openharmony/third_party_rust_nom.git
synced 2026-06-30 21:07:54 -04:00
fix other uses of MAX_INITIAL_CAPACITY_BYTES
fix panic when the output type is zero sized
This commit is contained in:
committed by
Geoffroy Couprie
parent
b3107081c7
commit
259016a1b8
+2
-1
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user