pub struct InflateLimits {
pub grace_size: u64,
pub max_expansion: u64,
pub max_size: u64,
}Expand description
How far compressed data may expand before it is taken for a decompression bomb.
Fields§
§grace_size: u64The output up to which the ratio is not checked: a small output cannot exhaust memory however well it compresses (a part of zeros, a blank picture).
max_expansion: u64Past Self::grace_size, the most the output may be as a multiple of the compressed
size.
max_size: u64The most the output may be at all.
Implementations§
Source§impl InflateLimits
impl InflateLimits
Sourcepub const POI: Self
pub const POI: Self
Apache POI’s ZipSecureFile defaults: GRACE_ENTRY_SIZE 100 KiB, MIN_INFLATE_RATIO
0.01 (at most 100 times), MAX_ENTRY_SIZE 4 GiB (the 32-bit ZIP limit).
Sourcepub fn allows(&self, compressed: u64, inflated: u64) -> bool
pub fn allows(&self, compressed: u64, inflated: u64) -> bool
Whether inflated bytes of output from compressed bytes stay within these limits.
Sourcepub fn check(&self, compressed: u64, inflated: u64) -> Result<()>
pub fn check(&self, compressed: u64, inflated: u64) -> Result<()>
Self::allows as a result: the error InflateGuard fails with when it does not.
Trait Implementations§
Source§impl Clone for InflateLimits
impl Clone for InflateLimits
impl Copy for InflateLimits
Source§impl Debug for InflateLimits
impl Debug for InflateLimits
Source§impl Default for InflateLimits
impl Default for InflateLimits
impl Eq for InflateLimits
Source§impl PartialEq for InflateLimits
impl PartialEq for InflateLimits
impl StructuralPartialEq for InflateLimits
Auto Trait Implementations§
impl Freeze for InflateLimits
impl RefUnwindSafe for InflateLimits
impl Send for InflateLimits
impl Sync for InflateLimits
impl Unpin for InflateLimits
impl UnsafeUnpin for InflateLimits
impl UnwindSafe for InflateLimits
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.