[Bug]: Pasting screenshot causes crash Simplex if too much data in screenshot

Open
#6,518 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
55/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
java, kotlin, linux
Domain
desktop

Research direction

Reproduce the crash on Linux using a large screenshot, then start at PlatformTextField.desktop.kt:150 and inspect the desktop clipboard path shown in the stack trace. Compare large and smaller pasted images; done means pasting a high-resolution screenshot no longer crashes the app.

Written by the indexing model from the issue text.

Description

bug triage
Is there an existing issue for this?
  • I have searched the existing issues
Platform

Linux

OS version

Arch

App version

6.4.8 (AppImage)

Current Behavior

I thoroughly tested it and my conversation partner also tested the same after I discovered the bug.
Observations:

  • Pasting a compressed image goes fine.
  • When I make a screenshot of my entire monitor then the app crashes immediately, reproducable with 100% hitrate
  • When I boxselect for the screenshot and I take a part of the monitor then the app does not crash up to a reassonably large rectangle
  • When I boxselect a much larger part of the monitor then the app does crash
  • My friend also tested this and for him also simplex immediately crashed after pasting the screenshot

Conclusion: as from a certain filesize or resolution simplex can not handle pasting a screenshot and as a result it crashes.

Resolution of my display: 2560x1440
Resolution of my friends his display: '4k'

Image
Expected Behavior

Obviously the expected behavior is that simplex does not crash when you paste a screenshot of a higher resolution.

Steps To Reproduce
  1. Make a screenshot of your entire monitor for at least 2560x1440 pixels.
  2. Paste it in the Simplex-AppImage which has the same version (6.4.8)
  3. App crashes
  4. Now make a screenshot of a much lower resolution, paste it in the app and it won't crash.
Relevant log output
I do not know how to quote a block of text (MarkDown??) instead of per line on GitHub, I post 2 outputs: from within the app and from the terminal (I started the app via the terminal). I leave a large number of whitelines in between the 2 outputs to make it visually clear.

In the Simplex-app itself I got this output: I copied it to the clipboard via the "share" button. 

java.io.IOException: INCR data is missed.
	at java.desktop/sun.awt.X11.XSelection.getData(Unknown Source)
	at java.desktop/sun.awt.X11.XClipboard.getClipboardData(Unknown Source)
	at java.desktop/sun.awt.datatransfer.SunClipboard.getData(Unknown Source)
	at chat.simplex.common.platform.PlatformTextField_desktopKt$PlatformTextField$4$1.invoke-ZmokQxo(PlatformTextField.desktop.kt:150)
	at chat.simplex.common.platform.PlatformTextField_desktopKt$PlatformTextField$4$1.invoke(PlatformTextField.desktop.kt:123)
	at androidx.compose.ui.input.key.KeyInputNode.onPreKeyEvent-ZmokQxo(KeyInputModifier.kt:93)
	at androidx.compose.ui.focus.FocusOwnerImpl.dispatchKeyEvent-YhN2O0w(FocusOwnerImpl.kt:347)
	at androidx.compose.ui.focus.FocusOwner.dispatchKeyEvent-YhN2O0w$default(FocusOwner.kt:128)
	at androidx.compose.ui.node.RootNodeOwner.onKeyEvent-ZmokQxo(RootNodeOwner.skiko.kt:299)
	at androidx.compose.ui.scene.CanvasLayersComposeSceneImpl.processKeyEvent-ZmokQxo(CanvasLayersComposeScene.skiko.kt:254)
	at androidx.compose.ui.scene.BaseComposeScene$inputHandler$4.invoke-ZmokQxo(BaseComposeScene.skiko.kt:64)
	at androidx.compose.ui.scene.BaseComposeScene$inputHandler$4.invoke(BaseComposeScene.skiko.kt:64)
	at androidx.compose.ui.scene.ComposeSceneInputHandler.onKeyEvent-ZmokQxo(ComposeSceneInputHandler.skiko.kt:136)
	at androidx.compose.ui.scene.BaseComposeScene.sendKeyEvent-ZmokQxo(BaseComposeScene.skiko.kt:261)
	at androidx.compose.ui.scene.ComposeSceneMediator.onKeyEvent(ComposeSceneMediator.desktop.kt:489)
	at androidx.compose.ui.scene.ComposeSceneMediator.access$onKeyEvent(ComposeSceneMediator.desktop.kt:117)
	at androidx.compose.ui.scene.ComposeSceneMediator$keyListener$1.keyPressed(ComposeSceneMediator.desktop.kt:284)
	at java.desktop/java.awt.Component.processKeyEvent(Unknown Source)
	at java.desktop/java.awt.Component.processEvent(Unknown Source)
	at java.desktop/java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
	at java.desktop/java.awt.KeyboardFocusManager.redispatchEvent(Unknown Source)
	at java.desktop/java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source)
	at java.desktop/java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Source)
	at java.desktop/java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Source)
	at java.desktop/java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source)
	at java.desktop/java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.Window.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
	at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
	at java.base/java.security.AccessController.doPrivileged(Unknown Source)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.desktop/java.awt.EventQueue$5.run(Unknown Source)
	at java.desktop/java.awt.EventQueue$5.run(Unknown Source)
	at java.base/java.security.AccessController.doPrivileged(Unknown Source)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)





In the terminal I got this output. 

Exception in thread "pool-1-thread-1" com.sshtools.twoslices.ToasterException: Failed to show toast for INFO: Chirpy
        at com.sshtools.twoslices.impl.NotifyToaster.toast(NotifyToaster.java:97)
        at com.sshtools.twoslices.ToastBuilder.toast(ToastBuilder.java:513)
        at chat.simplex.common.model.NtfManager$displayNotificationViaLib$2.invokeSuspend(NtfManager.desktop.kt:138)
        at chat.simplex.common.model.NtfManager$displayNotificationViaLib$2.invoke(NtfManager.desktop.kt)
        at chat.simplex.common.model.NtfManager$displayNotificationViaLib$2.invoke(NtfManager.desktop.kt)
        at chat.simplex.common.views.helpers.UtilsKt$wrapWithLogging$2.invokeSuspend(Utils.kt:50)
        at chat.simplex.common.views.helpers.UtilsKt$wrapWithLogging$2.invoke(Utils.kt)
        at chat.simplex.common.views.helpers.UtilsKt$wrapWithLogging$2.invoke(Utils.kt)
        at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:61)
        at kotlinx.coroutines.CoroutineScopeKt.coroutineScope(CoroutineScope.kt:261)
        at chat.simplex.common.views.helpers.UtilsKt.wrapWithLogging(Utils.kt:48)
        at chat.simplex.common.views.helpers.UtilsKt.wrapWithLogging$default(Utils.kt:48)
        at chat.simplex.common.views.helpers.UtilsKt$withBGApi$1$1.invokeSuspend(Utils.kt:40)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.base/java.lang.Thread.run(Unknown Source)
        Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@4d326f89, java.util.concurrent.Executors$FinalizableDelegatedExecutorService@439a7a4d]
E: App crashed, thread name: AWT-EventQueue-0, exception: java.io.IOException: INCR data is missed.
Dominant language
Haskell
Stars
19.5k
Forks
1.4k
Avg merge
1d 20h
Merged PRs (30d)
71

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from simplex-chat/simplex-chat

All issues in simplex-chat/simplex-chat

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.