szn

Bug 464 — Sixel placement ceil-div wraps and bypasses the oversize drop

464. Wrapping vs saturating ceil-div mismatch

Severity: MEDIUM Status: ✅ FIXED Files: src/screen.zig


Root Cause Analysis

Early drop at :232 saturates:

(px_height +| cell_px_height -| 1) / cell_px_height

Placement at :356 wraps:

(px_height + cell_px_height - 1) / cell_px_height

Huge px_width/px_height (wire-controlled, clamped only to 65535 in input.zig, and placeSixelImage is also directly callable) wraps to a small footprint and passes a check the early path would have dropped.

Proposed Fix

Use the same saturating form in both places. Add a test with px = maxInt(u32) asserting drop.