handleMouseFocus @intCast from usize to u32 can panic with oversized session namehandleMouseFocus @intCast from usize to u32 can panic with oversized session nameFile: src/server/server.zig:1231
Severity: LOW
Status: ✅ FIXED — added @min(len, maxInt(u32)) guard before @intCast and changed + to +| (saturating add) for both session.name.len and win.name.len casts. Unit test added with 300-char session name.
const prefix_len = 3 + @as(u32, @intCast(session.name.len));
session.name is []const u8, so session.name.len is usize. @intCast from usize to u32 performs a runtime safety check — if session.name.len > maxInt(u32), this panics. Session names are limited to maxInt(u8) bytes in practice (name_len is u8 in the protocol), but the type system doesn’t enforce this at the cast site.
Additionally, 3 + session.name.len uses wrapping addition (+). If session.name.len is maxInt(u32), prefix_len wraps to 2, producing incorrect status bar output.
Impact: Theoretical panic with session name > 4 GB. Wrapping arithmetic produces wrong status bar column at extreme values.