pub const MAXIMUM_ALLOWED_WINDOW_SIZE: u64 = _ /* 134_217_728u64 */;Expand description
Largest window a frame may declare before a decoder that holds the window
itself refuses it, unless FrameDecoder::set_max_window_size raised the
ceiling.
The bound is what makes decoding untrusted input safe: a frame header can
ask for a window far larger than the data behind it, and honouring that
would let a few bytes of input demand gigabytes of memory.
The decoder’s default window ceiling (128 MiB = 1 << 27), upstream zstd’s
default ZSTD_d_windowLogMax (ZSTD_WINDOWLOG_LIMIT_DEFAULT = 27). On the
paths where the decoder holds the window itself, a frame advertising a
larger one is refused to bound that allocation on untrusted input, until the
caller raises the ceiling (FrameDecoder::set_max_window_size). Every frame
our encoder emits by default (up to window_log 27 at level 22) fits it.