Parsers that can dynamically allocate RepeatVec, TakeVec, etc. can result in an OOM when ran on bad data. Introduce some global allocation limit such that when std::mem::size_of::<T> * N > LIMIT, parsing fails. The limit can be opt-in, defaulting to no limit. We'll have to account for nested heap-allocated types, such as u32::LE.repeat_vec(N).repeat_vec(M) somehow, or we can just opt for a single layer which will catch any extremely large N.
Parsers that can dynamically allocate
RepeatVec,TakeVec, etc. can result in an OOM when ran on bad data. Introduce some global allocation limit such that whenstd::mem::size_of::<T> * N > LIMIT, parsing fails. The limit can be opt-in, defaulting to no limit. We'll have to account for nested heap-allocated types, such asu32::LE.repeat_vec(N).repeat_vec(M)somehow, or we can just opt for a single layer which will catch any extremely large N.