packkit/limit

Resource limits for decoding untrusted input.

Types

Upper bounds a decoder checks while it reads. Going over any of them returns a LimitExceeded error instead of using more memory. Each field must be positive; a limit of 0 rejects every input.

Change one field with the record update syntax:

Limits(..limit.default(), max_input_bytes: 1_000_000)
pub type Limits {
  Limits(
    max_input_bytes: Int,
    max_output_bytes: Int,
    max_members: Int,
    max_entry_name_bytes: Int,
    max_entry_depth: Int,
  )
}

Constructors

  • Limits(
      max_input_bytes: Int,
      max_output_bytes: Int,
      max_members: Int,
      max_entry_name_bytes: Int,
      max_entry_depth: Int,
    )

    Arguments

    max_input_bytes

    Size of the compressed input. (default: 64_000_000)

    max_output_bytes

    Size of the decompressed output. (default: 256_000_000)

    max_members

    Number of entries in an archive. (default: 10_000)

    max_entry_name_bytes

    Length of an entry path in bytes. (default: 4096)

    max_entry_depth

    Number of path segments in an entry path, so a/b/c is 3. (default: 32)

Values

pub fn default() -> Limits

Returns the default limits listed on the fields of Limits.

✨ Search Document