Skip to main content

REGEX_SIZE_LIMIT

Constant REGEX_SIZE_LIMIT 

Source
const REGEX_SIZE_LIMIT: usize = _; // 1_048_576usize
Expand description

Compile-time bounds on a user regex (ADR-0023). The regex crate matches in guaranteed linear time (finite automata, no backtracking) — so there is no ReDoS execution blowup — but a pathological pattern can still demand a large program/DFA at build time. We index file names only (p99 ≈110 B), so a legitimate name regex never approaches 1 MiB; capping there turns a memory-DoS pattern into a clean CompiledTooBigFMF_E_QUERY_SYNTAX rejection (it flows through CompileError::Regex unchanged), instead of letting the elevated service compile it. Both default higher (10/2 MiB).