Skip to content

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

Closed

Description

@andrinoff

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).

Activity

  1. mavonx commented on Apr 28, 2026

    @mavonx
    Member

    /assign

  2. moved this from Backlog to In review in v1 Releaseon Apr 28, 2026
  3. added a commit that references this issue on Apr 28, 2026
    7c91cb4
  4. moved this from In review to Done in v1 Releaseon Apr 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions