pub const MAX_PS_STEPS: usize = 1_000_000;Expand description
Maximum operators a single type 4 evaluation may execute — pdfcer policy.
ISO 32000-1 imposes no execution-step limit of any kind. Annex C’s implementation limits cover object sizes and nesting in the file grammar, and §7.10.5.1 explicitly grants type 4 intermediate results an exemption from even those: “the intermediate results in type 4 function computations shall not [fall under those limits]. An implementation may use a representation that exceeds those limits.” There is no clause to cite for a step cap, which is exactly why this one is labelled policy.
What it actually defends against, stated honestly. Table 42 has no jump,
loop or repeat operator, and a { … } block runs at most once per
if/ifelse it is attached to — so an evaluation’s step count is bounded
above by the number of nodes in the parsed program. A type 4 function
therefore cannot hang. The hazard is size, not looping: a function stream
may decode to as much as pdfcer_model::filters::MAX_DECODED_LEN (256 MiB), which
is room for tens of millions of operators, and a DeviceN image runs the
transform once per pixel. This cap keeps that product bounded.
One million steps is several orders of magnitude beyond any legitimate tint transform (real ones run in tens of operators — the spec’s own DoubleDot example is nine) while keeping a hostile function’s per-evaluation cost to milliseconds. Tunable; not a conformance claim.