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

crash in storage.List() #3287

Closed
2 tasks done
secsys-go opened this issue Sep 28, 2022 · 0 comments
Closed
2 tasks done

crash in storage.List() #3287

secsys-go opened this issue Sep 28, 2022 · 0 comments
Labels
bug Something isn't working Hacktoberfest Issues that count towards Hacktoberfest scores.

Comments

@secsys-go
Copy link

Checklist

  • I have searched the issue tracker for open issues that relate to the same problem, before opening a new one.
  • This issue only relates to a single bug. I will open new issues for any other problems.

Describe the bug

We used the Fuzz engine to modify some Test(TestInMemoryRepositoryListing) data, and then the following crash appeared. Although Test does not handle the error returned by (storage.ParseURI, storage.CanList(foo)), such a crash occurs when corrupt data is passed into the storage.List()

How to reproduce

The simplified test code is in Example code

Screenshots

CrashLog

panic: runtime error: index out of range [-1] [recovered]
        panic: runtime error: index out of range [-1]

goroutine 19 [running]:
testing.tRunner.func1.2({0x6f8480, 0xc0001643d8})
        /home/zjx/.local/go/src/testing/testing.go:1211 +0x24e
testing.tRunner.func1()
        /home/zjx/.local/go/src/testing/testing.go:1214 +0x218
panic({0x6f8480, 0xc0001643d8})
        /home/zjx/.local/go/src/runtime/panic.go:1038 +0x215
fyne.io/fyne/v2/internal/repository.(*InMemoryRepository).List(0xc000140180, {0x789360, 0xc00012c360})
        /home/zjx/workspace/gowork/src/purelib/crashConfirm/fyne/internal/repository/memory.go:281 +0x330
fyne.io/fyne/v2/storage.List({0x789360, 0xc00012c360})
        /home/zjx/workspace/gowork/src/purelib/crashConfirm/fyne/storage/uri.go:481 +0x58
fyne.io/fyne/v2/internal/repository.TestInMemoryRepositoryListing(0x0)
        /home/zjx/workspace/gowork/src/purelib/crashConfirm/fyne/internal/repository/memory_test.go:334 +0x309

Example code

//part of the Test Code
	m := NewInMemoryRepository("000")
	repository.Register("dht", m)
	m.Data["/foo"] = []byte{1, 2, 3}
	m.Data["/foo/bar"] = []byte{1, 2, 3}
	m.Data["/foo/baz/"] = []byte{1, 2, 3}
	m.Data["/foo/baz/quux"] = []byte{1, 2, 3}

	foo, _ := storage.ParseURI("dht:?00000")

	canList, err := storage.CanList(foo)
	listing, err := storage.List(foo)

Fyne version

commit 638ae24 (HEAD -> master, origin/master, origin/HEAD)

Go compiler version

1.17.8

Operating system

Linux

Operating system version

OS: Linux r920 4.15.0-159-generic #167-Ubuntu

Additional Information

No response

@secsys-go secsys-go added the unverified A bug that has been reported but not verified label Sep 28, 2022
@andydotxyz andydotxyz added Hacktoberfest Issues that count towards Hacktoberfest scores. bug Something isn't working and removed unverified A bug that has been reported but not verified labels Oct 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Hacktoberfest Issues that count towards Hacktoberfest scores.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants