Skip to main content

value_nesting_within_limit

Function value_nesting_within_limit 

Source
pub fn value_nesting_within_limit(value: &Value, max_depth: usize) -> bool
Expand description

Iteratively check container-nesting depth of a runtime Value, returning false once nesting exceeds max_depth.

Unlike the parser guards above (which bound the DSL’s own syntax tree), values checked here come from verb handler results, e.g. a traverse or context result about to be stored as $prev chain context, and are otherwise unbounded. Walks an explicit worklist on the heap instead of native recursion, so a pathologically deep result cannot overflow the thread stack via Value::clone or serialization (CWE-674) before this check has a chance to reject it.