Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

A kitty placement with a large `r=`, `c=` or `s=` panics the emulator (u32 overflow)

Open Beginner friendly
#634 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
85/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
rust
Domain
cli, testing

Research direction

Start with kitty_cells in crates/termlens/src/graphics.rs around lines 1293–1307, where the issue identifies overflowing additions and multiplications. Add tests for u32::MAX in each of c, r, s, and v; the issue is done when none of these inputs panic or wrap.

Written by the indexing model from the issue text.

Description

bug good first issue

What happens. With .graphics(Graphics::Kitty) and a cell_size declared, the setup #588 added, a placement size chosen by the program under test overflows u32 and kills the reader thread in a debug build:

Terminal::builder().size(40, 10).cell_size(10, 20).graphics(Graphics::Kitty)
    .args(["-c", r"printf '\033_Ga=T,f=24,s=1,v=1,r=4294967295;AAAA\033\\'; printf after; sleep 2"])
    .spawn("sh")?
thread 'termlens-pty-reader' panicked at crates/termlens/src/graphics.rs:1297:36: attempt to multiply with overflow
the terminal emulator failed and the screen stopped advancing: attempt to multiply with overflow
key panic
c=4294967295 :1307:35 (multiply)
s=4294967295,v=1,X=5 :1293:13 (add)

In a release build the arithmetic wraps and the cursor moves by a nonsense amount.

Cause. kitty_cells (graphics.rs:1293-1307) computes src_w + offset_x, cell_h * rows, src_h + offset_y and cell_w * cols in u32.

Why it matters. Every number in a payload is chosen by the program under test. No input should be able to kill the emulator.

Fix. Do the arithmetic in u64 (or f64) and saturate on the way back, or use saturating_mul/saturating_add.

Done when u32::MAX in each of c, r, s and v neither panics nor wraps, with a test per key.

Dominant language
Rust
Stars
28
Forks
24
Avg merge
11h 23m
Merged PRs (30d)
42

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from vyncint/termlens

All issues in vyncint/termlens

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.