Skip to content

MessagePackDecodeLimits

[Source]

Limits for the streaming decoder. Protects against denial-of-service attacks where a malicious payload claims enormous sizes for variable-length values or deeply nested containers.

The default constructor applies conservative limits: 1 MB for str/bin/ext data, 131,072 for array/map element counts, and 512 for container nesting depth. Use unlimited() to disable all limits, or override individual limits:

// Default conservative limits:
let limits = MessagePackDecodeLimits

// Custom limits:
let limits = MessagePackDecodeLimits(
  where max_str_len' = 4096)

// No limits:
let limits = MessagePackDecodeLimits.unlimited()
class val MessagePackDecodeLimits

Constructors

create

[Source]

new val create(
  max_str_len': USize val = 1048576,
  max_bin_len': USize val = 1048576,
  max_ext_len': USize val = 1048576,
  max_array_len': U32 val = 131072,
  max_map_len': U32 val = 131072,
  max_depth': USize val = 512,
  max_skip_values': USize val = 1048576)
: MessagePackDecodeLimits val^

Parameters

  • max_str_len': USize val = 1048576
  • max_bin_len': USize val = 1048576
  • max_ext_len': USize val = 1048576
  • max_array_len': U32 val = 131072
  • max_map_len': U32 val = 131072
  • max_depth': USize val = 512
  • max_skip_values': USize val = 1048576

Returns


unlimited

[Source]

new val unlimited()
: MessagePackDecodeLimits val^

Returns


Public fields

let max_str_len: USize val

[Source]


let max_bin_len: USize val

[Source]


let max_ext_len: USize val

[Source]


let max_array_len: U32 val

[Source]


let max_map_len: U32 val

[Source]


let max_depth: USize val

[Source]


let max_skip_values: USize val

[Source]