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 widget.(*Entry).SelectedText #3290

Closed
2 tasks done
secsys-go opened this issue Sep 28, 2022 · 1 comment
Closed
2 tasks done

Crash in widget.(*Entry).SelectedText #3290

secsys-go opened this issue Sep 28, 2022 · 1 comment
Labels
bug Something isn't working

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(TestEntry_OnCopy) data, and then the following crash appeared. Is this due to some simulated keyboard operation?

How to reproduce

The simplified test code is in Example code

Screenshots

Crash Log

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

goroutine 88 [running]:
testing.tRunner.func1.2({0x87e8c0, 0xc0000240f0})
        /home/zjx/.local/go/src/testing/testing.go:1211 +0x24e
testing.tRunner.func1()
        /home/zjx/.local/go/src/testing/testing.go:1214 +0x218
panic({0x87e8c0, 0xc0000240f0})
        /home/zjx/.local/go/src/runtime/panic.go:1038 +0x215
fyne.io/fyne/v2/widget.(*Entry).SelectedText(0xc00000c1e0)
        /home/zjx/workspace/gowork/src/purelib/crashConfirm/fyne/widget/entry.go:442 +0x218
fyne.io/fyne/v2/widget.(*Entry).copyToClipboard(0xc00044dac0, {0x973e58, 0xc0005c8aa0})
        /home/zjx/workspace/gowork/src/purelib/crashConfirm/fyne/widget/entry.go:770 +0x3f
fyne.io/fyne/v2/widget.(*Entry).registerShortcut.func2({0x970180, 0xc0005c8ab0})
        /home/zjx/workspace/gowork/src/purelib/crashConfirm/fyne/widget/entry.go:887 +0x45
fyne.io/fyne/v2.(*ShortcutHandler).TypedShortcut(0xc00000c228, {0x970180, 0xc0005c8ab0})
        /home/zjx/workspace/gowork/src/purelib/crashConfirm/fyne/shortcut.go:21 +0x77
fyne.io/fyne/v2/widget.(*Entry).TypedShortcut(...)
        /home/zjx/workspace/gowork/src/purelib/crashConfirm/fyne/widget/entry.go:750
fyne.io/fyne/v2/widget_test.TestEntry_OnCopy(0x0)
        /home/zjx/workspace/gowork/src/purelib/crashConfirm/fyne/widget/entry_test.go:467 +0x14d

Example code

//part of the Test Code
	e := widget.NewEntry()
	e.SetText("\n\n\n\n\n\n\n\n\n\n")
	typeKeys(e, fyne.KeyRight, fyne.KeyRight, keyShiftLeftDown, fyne.KeyRight, fyne.KeyRight, fyne.KeyRight)

	clipboard := test.NewClipboard()
	shortcut := &fyne.ShortcutCopy{Clipboard: clipboard}
	e.TypedShortcut(shortcut)

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 added a commit to andydotxyz/fyne that referenced this issue Jan 8, 2023

Verified

This commit was signed with the committer’s verified signature.
weswigham Wesley Wigham
Fixes fyne-io#3290
@andydotxyz
Copy link
Member

Fixed on develop ready for next release

@andydotxyz andydotxyz added bug Something isn't working and removed unverified A bug that has been reported but not verified labels Jan 9, 2023
@andydotxyz andydotxyz added this to the Fixes (v2.3.x) milestone Jan 9, 2023
andydotxyz added a commit to andydotxyz/fyne that referenced this issue Feb 8, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Fixes fyne-io#3290
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants