Skip to content

[BUG] search_tui.rs Cursor Position Overflow with Long Input #190

@xyz080125

Description

@xyz080125

Project

vgrep

Description

In search_tui.rs line 220, the cursor position is calculated as area.x + self.input.len() as u16 + 1. If the input length exceeds u16::MAX - area.x - 1, this will overflow, causing the cursor to wrap around or panic.

Error Message

Debug Logs

System Information

OS: Any
Rust Version: 1.75+

Screenshots

No response

Steps to Reproduce

  1. Open vgrep TUI
  2. Paste an extremely long string (65535+ characters)
  3. Observe cursor behavior

Expected Behavior

Cursor should be constrained to the visible area, or input should be truncated with indication

Actual Behavior

Integer overflow in cursor position calculation

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingvalidValid issuevgrep

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions