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 because of storage.List #4271

Closed
2 tasks done
secsys-go opened this issue Sep 21, 2023 · 1 comment
Closed
2 tasks done

Crash because of storage.List #4271

secsys-go opened this issue Sep 21, 2023 · 1 comment
Labels
unverified A bug that has been reported but not verified

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. We debugged and eventually found the crash point is at line 300 of internal/repository/json.go. We feel that this could be an out-of-boundary bug.

How to reproduce

The simplified test code is in Example code

Screenshots

Crash log

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

goroutine 19 [running]:
testing.tRunner.func1.2({0x3f3d60, 0xc0000a2780})
	D:/.../go1.19/src/testing/testing.go:1396 +0x24e
testing.tRunner.func1()
	D:/.../go1.19/src/testing/testing.go:1399 +0x39f
panic({0x3f3d60, 0xc0000a2780})
	D:/.../go1.19/src/runtime/panic.go:884 +0x212
fyne.io/fyne/v2/internal/repository.(*InMemoryRepository).List(0xc00009c258, {0x4b9518?, 0xc0000e4690?})
	D:/.../fyne/internal/repository/memory.go:300 +0x32e
fyne.io/fyne/v2/storage.List({0x4b9518, 0xc0000e4690})
	D:/.../fyne/storage/uri.go:479 +0x58
fyne.io/fyne/v2/internal/repository.TestInMemoryRepositoryListing2(0x0?)
	D:/.../fyne/internal/repository/InMemoryRepositoryListing_fuzz_test.go:41 +0xfc
testing.tRunner(0xc000084d00, 0x44c160)
	D:/.../go1.19/src/testing/testing.go:1446 +0x10b
created by testing.(*T).Run
	D:/.../go1.19/src/testing/testing.go:1493 +0x35f

Example code

m := NewInMemoryRepository("mem")
repository.Register("mem", m)
m.Data[""] = []byte{1, 2, 3}
foo, _ := storage.ParseURI("mem:")
storage.List(foo)

Fyne version

commit cfb88d7

Go compiler version

1.19

Operating system and version

Windows 10

Additional Information

No response

@secsys-go secsys-go added the unverified A bug that has been reported but not verified label Sep 21, 2023
andydotxyz added a commit to andydotxyz/fyne that referenced this issue Sep 25, 2023
@andydotxyz
Copy link
Member

Fixed on develop, and will port it over to v2.4.1

@andydotxyz andydotxyz added this to the D fixes (v2.4.x) milestone Sep 27, 2023
andydotxyz added a commit that referenced this issue Oct 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
unverified A bug that has been reported but not verified
Projects
None yet
Development

No branches or pull requests

2 participants