szn

Bug 356 — Sixel raster dimensions: unsaturated digit accumulation

356. Same class as #354/#355 but in the DCS/sixel path

File: src/input.zig:550-556 and src/input.zig:563-569 (dispatchDcsSixel) Severity: CRITICAL Status: ✅ FIXED

Fix (applied)

Test: sixel raster dimensions saturate instead of overflowing — bug #356 (helper semantics incl. the exact "1;1;99999999999;88888888888 wire case fed end-to-end through the parser).

Problem

for (ph_str) |c| {
    if (std.ascii.isDigit(c)) {
        val = val * 10 + (c - '0');   // plain arithmetic on wire data

Any process can emit a sixel raster command with 11+ digits ("1;1;99999999999;240) → checked-overflow panic; ReleaseFast wraps into absurd pixel dimensions fed into addSixelImage. The 16 MiB payload cap bounds bytes, not digit counts. The CSI param parser was fixed for exactly this with saturating ops (bug #99); these two loops were missed.

Fix (proposed)

Use val = val *| 10 +% (c - '0') plus an early bail once val > some sane max, mirroring the CSI parser. Regression test with an overflowing raster string expecting defined clamping.