jesseduffield / jesseduffield/lazygit
Missing return in loadWorktrees + out-of-bounds risk in status parser
Open
- Dominant language
- Go
- Stars
- 82.4k
- Forks
- 3k
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 19
Description
Found two defensive issues:
**1. Missing return in `loadWorktrees` (refresh_helper.go)**
When `GetWorktrees()` returns an error, the error handling block sets `Worktrees` to an empty slice, but execution falls through to the next line which overwrites it with the (nil) `worktrees` return value. This means the empty-slice fallback never takes effect.
**2. Index out-of-bounds in file status parser (file_loader.go)**
When parsing `git status -z` output, renamed/copied entries (`R`/`C`) access `splitLines[i+1]` without bounds checking. If the output is truncated, this panics.
Contributor guide
Assessment
This issue has not been assessed yet.