File: src/input.zig:550-556 and src/input.zig:563-569
(dispatchDcsSixel)
Severity: CRITICAL
Status: ✅ FIXED
InputParser.parseDigitRunSaturating helper parses leading digit runs
with overflow-checked accumulation saturating at maxInt(u32); both raster
dimension loops now use it.MAX_SIXEL_DIM (65535) — anything larger
is garbage from a broken producer.addSixelImage footprint math uses saturating +| / -|
so no caller can re-introduce the overflow.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).
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.
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.