Skip to contents

Every reader treats its input as hostile. archive_limits() collects the bounds it enforces, for archive_open() to attach to a handle; the readers (archive_list(), archive_read(), archive_stream() and archive_extract()) check every member against them before handing over its bytes.

Usage

archive_limits(
  max_entries = 1e+06,
  max_member = 2^30,
  max_total = 2^32,
  max_ratio = 1000,
  max_name = 4096
)

Arguments

max_entries

Most members an archive may hold. A whole number from 1 to .Machine$integer.max.

max_member

Most uncompressed bytes of any one member. A whole number from 1 to 2^53, the largest a double holds exactly.

max_total

Most uncompressed bytes of all members together. A whole number from 1 to 2^53. For a tar compressed with gzip, zstd or lz4 it also bounds every byte the stream decodes to, headers and padding included, counted as they are decoded.

max_ratio

Largest ratio of a member's uncompressed bytes to its compressed bytes. A number from 1 to .Machine$integer.max; it need not be whole. DEFLATE cannot exceed about 1032:1, so the default stops a member compressed near that bound. tar and Compound File members are not compressed, so it does not apply to them; for a tar compressed with gzip, zstd or lz4 it bounds the bytes the whole stream decodes to over the compressed file's, counted as they are decoded.

max_name

Most bytes in a member name. A whole number from 1 to .Machine$integer.max.

Value

A list of class zuarchive_limits holding the five limits as doubles, in the order of the arguments.

Conditions

A value that is missing (NA, NaN), not a single number, infinite, fractional where a whole number is required, or outside its range raises an error of class zuarchive_error_limit, which inherits from zuarchive_error.

See also

Examples

archive_limits()
#> <zuarchive_limits>
#>   max_entries 1000000
#>   max_member  1073741824
#>   max_total   4294967296
#>   max_ratio   1000
#>   max_name    4096
archive_limits(max_member = 64 * 1024^2, max_ratio = 100)
#> <zuarchive_limits>
#>   max_entries 1000000
#>   max_member  67108864
#>   max_total   4294967296
#>   max_ratio   100
#>   max_name    4096