szn

Bug 466 — modifyOtherKeys extkeys truncates wire value despite no-truncate comment

466. @truncate on untrusted CSI param

Severity: MEDIUM Status: ❌ FALSE POSITIVE (intentional, tested behaviour) Files: src/input.zig, src/screen.zig


Resolution

Re-evaluated against src/input.zig:2377 (test "modifyOtherKeys huge level does not panic — bug #355"), which pins the truncate:

try parser.feed("\x1b[>4;999999m");
try testing.expectEqual(@as(u8, @truncate(@as(u32, 999999))), screen.extkeys);

The #355 fix deliberately replaced a panicking @intCast with a deterministic @truncate. Moreover extkeys is currently write-only state — the only readers are the tests themselves (screen.extkeys is never consumed by rendering, input forwarding, or the server), so the low byte can enable nothing observable. If extkeys ever gains a reader, that call site should validate levels (0/1/2) rather than re-litigating this parser. No code change made.