pub struct ModuleLimits {
pub max_module_bytes: usize,
pub max_expanded_locals: usize,
}Expand description
Per-module validation-time complexity limits (#32). Bounds compiler memory so a hostile
module can’t OOM the compiler before it ever executes — layered on top of wasmparser’s
hard per-dimension limits (function body size, locals, segment/type/function counts), which
it does not expose for tuning. Each knob is additive: a module must pass every cap.
Additive deviation from wasmtime — no analog in wasmtime. Default yields the
untrusted-tier ceilings (crate::Config::max_module_bytes /
crate::Config::max_expanded_locals); trusted/curated packages pass higher — but still
finite — limits via Module::new_with_limits.
Fields§
§max_module_bytes: usizeMaximum accepted module binary size, in bytes. Always finite (no unbounded option).
max_expanded_locals: usizeMaximum number of locals across all functions after run-length expansion. wasmparser
bounds locals per function only; this bounds the module-wide arena they expand into.