matcha icon indicating copy to clipboard operation
matcha copied to clipboard

BUG: Division by zero potential in imageRows when cellHeight is 0

Open andrinoff opened this issue 7 months ago • 1 comments

Describe the bug

In imageRows() (view/html.go:274-278), cellHeight from getCellHeightFromFd() could return 0 if the terminal doesn't support the ioctl query. The division (h + cellHeight - 1) / cellHeight would then panic with division by zero.

To reproduce

  1. Run matcha in a terminal that doesn't report cell size via ioctl
  2. Open an email with an inline image
  3. Observe division by zero panic

Expected behavior

Check cellHeight > 0 before dividing, default to a reasonable fallback (e.g. 16px).

andrinoff avatar Apr 24 '26 20:04 andrinoff

/assign

mavonx avatar Apr 28 '26 08:04 mavonx