Severity: MEDIUM (one buggy client corrupts sixel math for all sessions)
Status: 🟢 FIXED
Files: src/server/server.zig:2610-2622
.cell_size => {
if (pkt.data.len >= 8) {
const height_px = std.mem.readInt(u32, pkt.data[0..4], .little);
const width_px = std.mem.readInt(u32, pkt.data[4..8], .little);
self.cell_px_height = height_px;
self.cell_px_width = width_px;
...
self.applyCellSizeToAllScreens();
}
},
Unlike .resize (clamped to [2,4096]), cell_px_height/cell_px_width accept any u32 — including 0xFFFFFFFF — and push it into every pane’s Screen. Today updateCellSize rejects 0 so there’s no crash, and absurd values mostly produce absurd-but-bounded sixel footprints; but one buggy or malicious client permanently corrupts the geometry math for all sessions server-wide, with no way to recover except restarting the server or sending a corrective message.
Validate like .resize: reject 0, clamp to a sane range (e.g. [1, 1024] px) at the wire boundary in the .cell_size handler, before storing server-wide.
In the .cell_size packet handler in src/server/server.zig, added checks to ensure raw_h > 0 and raw_w > 0 (ignoring messages with zero dimensions) and clamped dimensions to [1, 1024] using std.math.clamp. Added regression test cell_size wire message clamps dimensions and ignores zeroes — bug #496.