Bug 429049 - Crash when dragging empty layer outside of Krita
Summary: Crash when dragging empty layer outside of Krita
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: General (show other bugs)
Version: 4.4.1
Platform: Arch Linux Linux
: NOR crash
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-11-13 08:28 UTC by Awakening
Modified: 2020-12-19 10:50 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Stack trace (4.94 KB, text/plain)
2020-11-13 08:28 UTC, Awakening
Details
gdb trace of Thread 1 (10.63 KB, text/plain)
2020-11-13 19:32 UTC, Ahab Greybeard
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Awakening 2020-11-13 08:28:42 UTC
Created attachment 133289 [details]
Stack trace

SUMMARY
Krita can crash, when dragging an empty layer outside of main window, depending on what you're dragging it over.

STEPS TO REPRODUCE
1. Create a new document
2. Create a new paint layer
3. Drag the empty paint layer over Plasma desktop / Visual Studio Code

OBSERVED RESULT
Crash

EXPECTED RESULT
No crash

SOFTWARE/OS VERSIONS
Linux: 5.9.8-arch1-1
KDE Plasma: 5.20.3
KDE Frameworks Version: 5.75.0
Qt Version: 5.15.1

ADDITIONAL INFORMATION
Doesn't seem to affect Windows, couldn't reproduce there.

Terminal output right before the crash:
```
libpng warning: Image width is zero in IHDR
libpng warning: Image height is zero in IHDR
libpng error: Invalid IHDR data
Segmentation fault (core dumped)
```
Comment 1 Ahab Greybeard 2020-11-13 19:32:15 UTC
Created attachment 133313 [details]
gdb trace of Thread 1

Testing with the Nov 13 4.4.3 alpha (git 235939b) appimage on Debian 10 with the MATE desktop:

I don't get a crash if I drag an empty layer from the Layers docker over anywhere, including the desktop and floating dockers, then put it back on the Layers docker.

If I drag a layer with content onto the workspace/canvas, it duplicates the layer and gives it the same name.
Drag/dropping it anywhere else has no effect.

Drag/dropping an empty layer onto the workspace/canvas gives a crash.
I attach a gdb thread listing.

Setting to Confirmed
Comment 2 Bug Janitor Service 2020-12-14 17:31:42 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/krita/-/merge_requests/619
Comment 3 Awakening 2020-12-19 09:53:39 UTC
Git commit 11a8010dd4713aea1482d98b1b0beec6e672388b by Lucid Sunlight.
Committed on 18/12/2020 at 13:59.
Pushed by dkazakov into branch 'master'.

Don't build .kra file if image is empty

Happens when drag&dropping empty layers.

Can cause modulo by zero crash in `KisDocument::generatePreview`
when dragging onto canvas, or somewhere in QuaZip when dragging
outside of Krita.

M  +4    -0    plugins/impex/kra/kra_converter.cpp

https://invent.kde.org/graphics/krita/commit/11a8010dd4713aea1482d98b1b0beec6e672388b
Comment 4 Awakening 2020-12-19 09:53:48 UTC
Git commit f55654f84a751a2f8433a016998f34cb8f7c88f5 by Lucid Sunlight, on behalf of Dmitry Kazakov.
Committed on 18/12/2020 at 14:02.
Pushed by dkazakov into branch 'master'.

Default to image bounds if nodes are empty

Prevents creating an invalid image.

M  +4    -0    libs/ui/kis_mimedata.cpp

https://invent.kde.org/graphics/krita/commit/f55654f84a751a2f8433a016998f34cb8f7c88f5
Comment 5 Dmitry Kazakov 2020-12-19 10:49:23 UTC
Git commit e5a71530fc4d38fa10904765a1e451ff694cffe0 by Dmitry Kazakov, on behalf of Lucid Sunlight.
Committed on 19/12/2020 at 10:47.
Pushed by dkazakov into branch 'krita/4.3'.

Don't build .kra file if image is empty

Happens when drag&dropping empty layers.

Can cause modulo by zero crash in `KisDocument::generatePreview`
when dragging onto canvas, or somewhere in QuaZip when dragging
outside of Krita.

M  +4    -0    plugins/impex/kra/kra_converter.cpp

https://invent.kde.org/graphics/krita/commit/e5a71530fc4d38fa10904765a1e451ff694cffe0
Comment 6 Dmitry Kazakov 2020-12-19 10:49:31 UTC
Git commit 5bc380c6f23e209e8543af17cc94dd8e1cc03282 by Dmitry Kazakov.
Committed on 19/12/2020 at 10:48.
Pushed by dkazakov into branch 'krita/4.3'.

Default to image bounds if nodes are empty

Prevents creating an invalid image.

M  +4    -0    libs/ui/kis_mimedata.cpp

https://invent.kde.org/graphics/krita/commit/5bc380c6f23e209e8543af17cc94dd8e1cc03282
Comment 7 Dmitry Kazakov 2020-12-19 10:50:34 UTC
Git commit 6659bb5099241657310f0a88417988c44f8b058b by Dmitry Kazakov, on behalf of Lucid Sunlight.
Committed on 19/12/2020 at 10:50.
Pushed by dkazakov into branch 'krita/4.4.2'.

Don't build .kra file if image is empty

Happens when drag&dropping empty layers.

Can cause modulo by zero crash in `KisDocument::generatePreview`
when dragging onto canvas, or somewhere in QuaZip when dragging
outside of Krita.

M  +4    -0    plugins/impex/kra/kra_converter.cpp

https://invent.kde.org/graphics/krita/commit/6659bb5099241657310f0a88417988c44f8b058b
Comment 8 Dmitry Kazakov 2020-12-19 10:50:42 UTC
Git commit 4c73e176f847fae9ac945ef8a7bedef282c07c0a by Dmitry Kazakov.
Committed on 19/12/2020 at 10:50.
Pushed by dkazakov into branch 'krita/4.4.2'.

Default to image bounds if nodes are empty

Prevents creating an invalid image.

M  +4    -0    libs/ui/kis_mimedata.cpp

https://invent.kde.org/graphics/krita/commit/4c73e176f847fae9ac945ef8a7bedef282c07c0a