Skip to main content

MAX_PS_NESTING

Constant MAX_PS_NESTING 

Source
pub const MAX_PS_NESTING: usize = 32;
Expand description

Maximum { } nesting depth inside a type 4 program — pdfcer policy.

§7.10.5.1 describes the brace syntax for if/ifelse and states no depth limit; Annex C’s nesting limits are about the file grammar (arrays and dictionaries), not this sub-language. The cap exists because the parser recurses one frame per {, and pdfcer-core’s panic-free policy treats a stack overflow from untrusted input exactly as seriously as an unwrap — an abort is not a graceful refusal.

32 is far past any hand-written or machine-generated transform; the deepest realistic construct is a handful of nested ifelse branches.