[Bug]: VT100 parser becomes corrupted when ANSI escape sequences are split by TCP packets
Problem description
When using nc to connect to remote TCP servers, if ANSI escape sequences are split across multiple TCP packets, the Termux VT100 terminal parser enters a corrupted internal state. All subsequent output becomes garbled with repeated garbage characters.
Expected behavior: The terminal parser should reset its state machine when an incomplete ANSI escape sequence is received, discard partial control sequence and render normal text correctly.
Environment:
- Termux application version: latest
- Android OS version: 14
- Device model: Snapdragon 888
Workaround: Use pwntools Python script to read raw socket bytes, bypassing Termux terminal renderer.
Note: Same nc command works fine on desktop Linux xterm/gnome‑terminal. Terminal Operation Log
.../Download/Browser $ .../Download/Browser $ nc green-hill.picoctf.net 54683 Enter a numeric code (must be > 999 ): 3E8 Access granted: }1a9ftc_oc_ipb50aftc_oc_ip8_99ftc_oc_ip9_TGftc_oc_ip_xehftc_oc_ip_tigftc_oc_ipid_3ftc_oc_ip{FTCftc_oc_ipocipftc_oc_ip .../Download/Browser $ python
Steps to reproduce the behavior.
- Open Termux, run
nc <remote‑host> <port>to connect to a TCP server that outputs ANSI escape codes. - Send any input to the remote server.
- If ANSI escape sequence is split across multiple TCP packets, terminal becomes corrupted and outputs repeated garbage characters.
This does not happen on desktop Linux xterm / gnome‑terminal.
What is the expected behavior?
When receiving incomplete ANSI escape sequence bytes due to network packet splitting, the VT100 parser should reset its internal state machine, discard the partial control sequence, and continue rendering normal text without garbled repeated output.
System information
- Termux application version:latest
- Android version:14
- Device model:Snapdragon 888
Source: termux/termux-app