Checklist
Output of fzf --version
0.67.0
OS
Shell
Problem / Steps to reproduce
FuzzyMatchV2 panics with index out of range [-1639] when given a very long matching pattern and text.
package main
import (
"fmt"
"slices"
"strings"
"unicode"
"github.com/junegunn/fzf/src/algo"
"github.com/junegunn/fzf/src/util"
)
func main() {
size := 1640
longPattern := strings.Repeat("a", size)
longText := strings.Repeat("a", size)
runes := []rune(longPattern)
chars := util.ToChars([]byte(longText))
res, pos := algo.FuzzyMatchV2(slices.ContainsFunc(runes, unicode.IsUpper), true, true, &chars, runes, true, nil)
fmt.Println(res.Score, len(*pos))
}
go run .
panic: runtime error: index out of range [-1639]
goroutine 1 [running]:
github.com/junegunn/fzf/src/algo.FuzzyMatchV2(0x0, 0x1, 0x1, 0xc0000bcee0, {0xc0000d6000, 0x668, 0x6a0}, 0x1, 0x0)
/home/riaru/go/pkg/mod/github.com/junegunn/fzf@v0.67.0/src/algo/algo.go:625 +0x1cb0
main.main()
/mnt/nfs/riaru/Projects/fzf-bug-report/main.go:21 +0x1ca
exit status 2
the code for the minimal example I created can be found here:
https://go.dev/play/p/gRq21-fe4oI
https://github.com/Ori-Riaru/fzf-bug-report
Checklist
man fzf)Output of
fzf --version0.67.0
OS
Shell
Problem / Steps to reproduce
FuzzyMatchV2 panics with
index out of range [-1639]when given a very long matching pattern and text.the code for the minimal example I created can be found here:
https://go.dev/play/p/gRq21-fe4oI
https://github.com/Ori-Riaru/fzf-bug-report