Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix slicing panic in path completion variable expansion
The regexes in `expand_impl` may match multiple times on a single variable like `${HOME:-$HOME}`: once for the `${HOME:-` part and again for its default value `$HOME`. This could cause a panic because of an invalid slice `&bytes[pos..range.start]`: `pos` is set to `range.end` which corresponds to the closing `}` in the first iteration of the loop, so it's greater than `range.start` in the second iteration.
- Loading branch information