szn

Bug 321 — Uncapped loop in CSI ‘Z’ handler causes CPU exhaustion DoS

321. Uncapped loop in CSI ‘Z’ handler causes CPU exhaustion DoS

File: src/input.zig:640-660 Severity: HIGH Status: ✅ FIXED

In src/input.zig, CSI ‘Z’ (CBT) executed while (i < n) without checking whether cursor position reached boundary limits.

Root Cause

Missing loop termination check when cursor reaches (0, 0).

Fix

Capped parameter to @min(n, 1000) and added an explicit break when cursor cannot move backward any further.

Impact

Rogue or malformed output sending \x1b[99999999Z locks up the server event loop in a CPU exhaustion DoS spike.