szn

Bug 354 — Remote panic: modifyOtherKeys extkeys @intCast truncation

354. One escape sequence from a pane kills the multiplexer

File: src/input.zig:754 Severity: CRITICAL Status: ✅ FIXED

Fix (applied)

src/input.zig now uses @truncate for the modifyOtherKeys level (wire-controlled u32 → u8 extkeys mode), matching how small mode numbers are handled elsewhere. Normal levels (0-2) unaffected.

Test: modifyOtherKeys huge level does not panic — bug #355 (feeds \x1b[>4;999999m, asserts truncated-but-defined result and that level 2 still applies).

Problem

Any program running in a pane can print \x1b[>4;<huge>m and crash szn (“integer cast truncated bits”) in Debug/ReleaseSafe; ReleaseFast wraps to a meaningless extkeys value.

Root Cause

} else if (self.intermediate == '>') {
    const sub_mode = self.param(0);
    if (sub_mode == 4) {
        if (self.param_count >= 2) {
            self.screen.extkeys = @intCast(self.params[1]);   // u32 → u8

params[1] is a raw, saturating-parsed u32 from the wire; Screen.extkeys is u8. Same class as bug #99 (fixed elsewhere with *|/+|) and bug #353.

Fix (proposed)

self.screen.extkeys = @truncate(self.params[1]); or @intCast(@min(self.params[1], 255)). Regression test: feed "\x1b[>4;999999m" — no panic, extkeys defined.