Skip to main content

Module ansi

Module ansi 

Source
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.