Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: integer underflow when result list empty and pressing "up" #2393

Closed
1 task done
cloneable opened this issue Sep 21, 2024 · 0 comments · Fixed by #2395
Closed
1 task done

[Bug]: integer underflow when result list empty and pressing "up" #2393

cloneable opened this issue Sep 21, 2024 · 0 comments · Fixed by #2395
Labels
bug Something isn't working

Comments

@cloneable
Copy link

What did you expect to happen?

No action.

What happened?

thread 'main' panicked at crates/atuin/src/command/client/search/interactive.rs:537:41:
attempt to subtract with overflow

self.results_state.select(i.min(self.results_len - 1));

Atuin doctor output

{
  "atuin": {
    "version": "18.4.0-beta.3",
    "sync": null,
    "sqlite_version": "3.46.0"
  },
  "shell": {
    "name": "zsh",
    "default": "zsh",
    "plugins": [
      "atuin"
    ],
    "preexec": "built-in"
  },
  "system": {
    "os": "Darwin",
    "arch": "arm64",
    "version": "15.0",
    "disks": [
      {
        "name": "Macintosh HD",
        "filesystem": "apfs"
      },
      {
        "name": "Macintosh HD",
        "filesystem": "apfs"
      }
    ]
  }
}

Code of Conduct

  • I agree to follow this project's Code of Conduct
@cloneable cloneable added the bug Something isn't working label Sep 21, 2024
jeremycline added a commit to jeremycline/atuin that referenced this issue Sep 21, 2024
In the event there are no results and up is pressed, saturating_sub()
should be used to avoid underflowing the usize. This was already present
on scroll_down().

fixes atuinsh#2393
@ellie ellie closed this as completed in a1a157c Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant