szn

Bug 150 — tty/tty_key.zig — Invalid UTF-8 lead bytes 0xC0–0xC1 accepted into multi-byte state

150. tty/tty_key.zig — Invalid UTF-8 lead bytes 0xC0–0xC1 accepted into multi-byte state

File: src/tty/tty_key.zig:73–77 Severity: LOW Status: ✅ FIXED — changed range from 0xc0..0xdf to 0xc2..0xdf.

if (byte >= 0xc0 and byte <= 0xdf) {
    rd.buf[0] = byte;
    rd.pos = 1;
    rd.state = .utf8_2;
    return null;
}

Bytes 0xC0 and 0xC1 are never valid UTF-8 lead bytes (they would produce overlong encodings of ASCII). The parser enters utf8_2 state, consumes a continuation byte, then utf8Decode rejects it — silently dropping two bytes instead of one.