Symptom
structalign -diff=side -width=4611686018427387904 ./_example
panic: runtime error: makeslice: len out of range
A user-supplied -width propagates unclamped into internal/ui:
truncPad → runewidth.FillRight(s, w) tries to allocate w bytes
renderSideBySide's divider → strings.Repeat("─", p.Width) likewise
Origin
Found by the ClusterFuzzLite integration work (#99): fuzz_trunc_pad crashed within 5 seconds in the OSS-Fuzz container. The bug is pre-existing — the pre-#94 hand-rolled loop had the identical strings.Repeat(" ", w-total) panic.
Fix
Clamp the column width to a sane maximum (far wider than any terminal) in truncPad (totality of the fuzzed contract) and in renderSideBySide (covers the divider). Regression test included.
Symptom
A user-supplied
-widthpropagates unclamped intointernal/ui:truncPad→runewidth.FillRight(s, w)tries to allocatewbytesrenderSideBySide's divider →strings.Repeat("─", p.Width)likewiseOrigin
Found by the ClusterFuzzLite integration work (#99):
fuzz_trunc_padcrashed within 5 seconds in the OSS-Fuzz container. The bug is pre-existing — the pre-#94 hand-rolled loop had the identicalstrings.Repeat(" ", w-total)panic.Fix
Clamp the column width to a sane maximum (far wider than any terminal) in
truncPad(totality of the fuzzed contract) and inrenderSideBySide(covers the divider). Regression test included.