Skip to main content

MAX_FALLBACK_SCAN_BYTES

Constant MAX_FALLBACK_SCAN_BYTES 

Source
pub const MAX_FALLBACK_SCAN_BYTES: usize = 1024;
Expand description

Upper bound, in bytes past search_from, on how far locate_value_span’s fallback scan will search.

The fallback exists only to correct for yaml-rust2’s marker-vs-value quoting offset — a handful of bytes at most for any real manifest value. Leaving the scan unbounded made it an O(line_length x value_length) scan over the rest of the line regardless of how far away the real match could possibly be: a several-megabyte single-line manifest (comfortably under the crate’s YAML expansion-size gate) could cost whole minutes of single-core CPU per didOpen/didChange (security S-2). Capping the window bounds the fallback’s cost independent of line length; a value that genuinely cannot be located within this window is treated the same as any other unlocatable value — the candidate is silently skipped, not an error.