Expand description
ANSI escape sequence parsing constants ANSI escape sequence parsing constants
These constants prevent infinite loops when parsing malformed ANSI sequences. See: https://github.com/anthropics/claude-code/issues/22094
Constants§
- ANSI_
MAX_ CSI_ PARAM_ LENGTH - Maximum parameter length for CSI sequences (e.g., ESC[…m). CSI parameters are typically short numeric values separated by semicolons.
- ANSI_
MAX_ ESCAPE_ SEQ_ LENGTH - Maximum length for OSC/DCS/PM/APC/SOS escape sequences before bailing out. OSC sequences rarely exceed 4KB in practice (e.g., hyperlinks, window titles). This guard prevents CPU spinning on malformed input.