We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Discovered adding fuzz tests with #8
Reproducing test:
func TestIncompleteLast(t *testing.T) { a := "00000000000000000000" + "00000000000000000000" + "00000000000000000000" + "000\xcb" r := New() if err := r.Insert(0, a); err != nil { t.Fatal(err) } assert.Equal(t, a, r.String()) }
--- FAIL: TestIncompleteLast (0.00s) panic: runtime error: slice bounds out of range [recovered] panic: runtime error: slice bounds out of range goroutine 11 [running]: testing.tRunner.func1(0xc420102690) /home/codegoalie/workspace/sources/go/src/testing/testing.go:711 +0x2d2 panic(0x6f86c0, 0x94c330) /home/codegoalie/workspace/sources/go/src/runtime/panic.go:491 +0x283 github.com/codegoalie/skiprope.(*Rope).SubstrBytes(0xc420104900, 0x0, 0x40, 0x0, 0xc420299600, 0x40) /home/codegoalie/workspace/go/src/github.com/codegoalie/skiprope/rope.go:107 +0x3b0 github.com/codegoalie/skiprope.(*Rope).Substr(0xc420104900, 0x0, 0x40, 0x4e5b01, 0xc420104900) /home/codegoalie/workspace/go/src/github.com/codegoalie/skiprope/rope.go:121 +0x3f github.com/codegoalie/skiprope.(*Rope).String(0xc420104900, 0x0, 0x75c744) /home/codegoalie/workspace/go/src/github.com/codegoalie/skiprope/rope.go:186 +0x3d github.com/codegoalie/skiprope.TestIncompleteLast(0xc420102690) /home/codegoalie/workspace/go/src/github.com/codegoalie/skiprope/rope_test.go:212 +0x17d testing.tRunner(0xc420102690, 0x764360) /home/codegoalie/workspace/sources/go/src/testing/testing.go:746 +0xd0 created by testing.(*T).Run /home/codegoalie/workspace/sources/go/src/testing/testing.go:789 +0x2de exit status 2 FAIL github.com/codegoalie/skiprope 0.011s
The text was updated successfully, but these errors were encountered:
String()
Looks like the reason is it's not calculating the length of bytes correctly. What do you think the fix should be?
Sorry, something went wrong.
Seems like we are getting Rope.runes from utf8.RuneCount which treats incorrect stuff as a single rune:
Rope.runes
utf8.RuneCount
RuneCount returns the number of runes in p. Erroneous and short encodings are treated as single runes of width 1 byte.
Perhaps there are instances where we are counting runes when we should be counting bytes? I haven't been able to dig into much of the search.go code.
search.go
codegoalie
Successfully merging a pull request may close this issue.
Discovered adding fuzz tests with #8
Reproducing test:
The text was updated successfully, but these errors were encountered: