Enum MemoryLimit

pub enum MemoryLimit

The maximum amount of memory the decoder is allowed to use for each frame

Variants

Unlimited

Enforce no memory limit.

If you intend to process images from unknown origins this is a potentially dangerous constant to use, as your program could be vulnerable to decompression bombs. That is, malicious images crafted specifically to require an enormous amount of memory to process while having a disproportionately small file size.

The risks for modern machines are a bit smaller as the size of each frame cannot exceed 16GiB, but this is still a significant amount of memory.

Bytes(NonZeroU64)

Limit the amount of memory that can be used for a single frame to this many bytes.

It may not be enforced precisely due to allocator overhead and the decoder potentially allocating small auxiliary buffers, but it will precisely limit the size of the output buffer for each frame.

Trait Implementations

impl Clone for MemoryLimit

fn clone(&self) -> Self

impl Debug for MemoryLimit

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Auto Trait Implementations

impl Freeze for MemoryLimit

impl RefUnwindSafe for MemoryLimit

impl Send for MemoryLimit

impl Sync for MemoryLimit

impl Unpin for MemoryLimit

impl UnsafeUnpin for MemoryLimit

impl UnwindSafe for MemoryLimit

Blanket Implementations

impl<T> Any for MemoryLimit where T: 'static + ?Sized,

impl<T> Borrow<T> for MemoryLimit where T: ?Sized,

impl<T> BorrowMut<T> for MemoryLimit where T: ?Sized,

impl<T> CloneToUninit for MemoryLimit where T: Clone,

impl<T> From<T> for MemoryLimit

impl<T> ToOwned for MemoryLimit where T: Clone,

impl<T, U> Into<U> for MemoryLimit where U: From<T>,

impl<T, U> TryFrom<U> for MemoryLimit where U: Into<T>,

impl<T, U> TryInto<U> for MemoryLimit where U: TryFrom<T>,