szn

Bug 164 — server/render.zig — SGR buffer overflow with all 11 attributes + RGB fg/bg

164. server/render.zig — SGR buffer overflow with all 11 attributes + RGB fg/bg

File: src/server/render.zig:332 Severity: CRITICAL Status: ✅ FIXED — buffer increased from 128 to 256 bytes; all catch unreachable replaced with graceful skip (catch "" or catch break) so overflow just drops the attribute instead of crashing.

var sgr_buf: [128]u8 = undefined;

The SGR buffer has 128 bytes. Worst-case: \x1b[m (3) + 11 attrs at \x1b[{s}m (max 8 each = 88) + RGB fg \x1b[38;2;R;G;Bm (20) + RGB bg \x1b[48;2;R;G;Bm (20) = 131 bytes > 128. All bufPrint calls use catch unreachable — when this overflows, szn panics instantly.

This is triggered when any cell has all 11 rendering attributes active simultaneously (bold+dim+italic+underline+blink+reverse+concealed+strikethrough+overline+double_underline+curly_underline) with RGB fg and bg colours. opencode’s terminal output with rich formatting can easily trigger this.

Fix: Increase buffer to 256 bytes, replace all catch unreachable with graceful skip (continue/break) when buffer is full.