Bug 491231

Summary: L*A*B* colorspace document export to webp crash.
Product: [Applications] krita Reporter: thescorched
Component: File formatsAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: minor CC: halla
Priority: NOR    
Version: 5.2.3   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: gdb trace reproducing krita crash with debug info fetched with debuginfod

Description thescorched 2024-08-03 20:17:31 UTC
Created attachment 172259 [details]
gdb trace reproducing krita crash with debug info fetched with debuginfod

Exporting a L*A*B* colorspace document to webp crashes krita and does not save the image. Reproducible on my system.

Not Working: 
1. Open Krita
2. Click "New Image"
3. Input the Image Size and Color settings for a 128x128 L*a*b*/Alpha 8-bit integer/channel document.
4. Click "Create"
5. Click "File"
6. Click "Export"
7. Input any filename that ends with .webp and click "Ok" on the default webp export settings.
8. Crash

Working:
1. Open Krita
2. Click "New Image"
3. Input the Image Size and Color settings for a 128x128 RGB/Alpha 8-bit integer/channel document.
4. Click "Create"
5. Click "File"
6. Click "Export"
7. Input any filename that ends with .webp and click "Ok" on the default webp export settings.
8. The file gets saved and krita does not crash.

Additionally:
Tested the flathub 5.2.3 version, same result
Tested the krita-5.2.5-prealpha-4e96fd2674-x86_64.appimage version, same result
The gdb trace should have debug info automatically fetched with debuginfod

Kinfocenter Copy:
Operating System: Arch Linux 
KDE Plasma Version: 6.1.3
KDE Frameworks Version: 6.4.0
Qt Version: 6.7.2
Kernel Version: 6.10.2-arch1-1 (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 7800X3D 8-Core Processor
Memory: 30.5 GiB of RAM
Graphics Processor: AMD Radeon RX 580 Series
Product Name: B650M PG Riptide
Comment 1 Halla Rempt 2024-08-04 08:20:21 UTC
I can confirm the issue. Something goes wrong when converting the image to rgb (which is necessary, because webp doesn't support lab).
Comment 2 Halla Rempt 2024-08-04 08:24:30 UTC
For some reason the destination colorspace object is 0:

0x00007ffff3ebdbbe in KoColorSpace::operator== (this=0x5555570aa400, rhs=...) at /home/halla/dev/5.2/libs/pigment/KoColorSpace.cpp:98
98          const KoColorProfile* p1 = rhs.profile();
(gdb) bt
#0  0x00007ffff3ebdbbe in KoColorSpace::operator== (this=0x5555570aa400, rhs=...)
    at /home/halla/dev/5.2/libs/pigment/KoColorSpace.cpp:98
#1  0x00007ffff3ebddaf in KoColorSpace::convertPixelsTo (this=this@entry=0x5555570aa400, 
    src=src@entry=0x7ffe73ece010 "\376\376\375\377\375\376\375\376\376\376\376\377\375\376\375\376\376\376\375\377\375\376\375\376\376\376\375\377\375\376\375\376\376\376\375\377\375\376\375\376\376\377\376\377\376\376\375\377\375\376\375\376\376\376\375\377\376\376\375\377\376\376\375\376\376\376\376\377\375\376\375\376\376\376\375\377\375\376\375\376\376\376\375\377\375\376\375\376\375\376\375\376\376\376\376\377\375\376\375\376\375\376\375\376\375\376\375\376\376\377\376\377\376\377\376\377\375\376\375\376\376\377\376\377\375\376\375\376\376\376\375\377\376\377\376\377\375\376\375\376\375\376\375\376\376\376\375\376\376\376\375\377\375\376\375\376\376\376\375\377\376\376\375\377\376\376\375\376\376\377\376\377\375\376\375\376\376\376\375\377\376\376\375\377\376\377\376\377\375\376\375\376\376\376\375\377\376\376\375\376"..., dst=0x7ffe71d9e010 "", dstColorSpace=dstColorSpace@entry=0x0, 
    numPixels=numPixels@entry=8699840, 
    renderingIntent=renderingIntent@entry=KoColorConversionTransformation::IntentPerceptual, 
    conversionFlags=...) at /home/halla/dev/5.2/libs/pigment/KoColorSpace.cpp:468
#2  0x00007ffff3ec70fe in KoColorSpace::convertToQImage (this=0x5555570aa400, 
    data=0x7ffe73ece010 "\376\376\375\377\375\376\375\376\376\376\376\377\375\376\375\376\376\376\375\377\375\376\375\376\376\376\375\377\375\376\375\376\376\376\375\377\375\376\375\376\376\377\376\377\376\376\375\377\375\376\375\376\376\376\375\377\376\376\375\377\376\376\375\376\376\376\376\377\375\376\375\376\376\376\375\377\375\376\375\376\376\376\375\377\375\376\375\376\375\376\375\376\376\376\376\377\375\376\375\376\375\376\375\376\375\376\375\376\376\377\376\377\376\377\376\377\375\376\375\376\376\377\376\377\375\376\375\376\376\376\375\377\376\377\376\377\375\376\375\376\375\376\375\376\376\376\375\376\376\376\375\377\375\376\375\376\376\376\375\377\376\376\375\377\376\376\375\376\376\377\376\377\375\376\375\376\376\376\375\377\376\376\375\377\376\377\376\377\375\376\375\376\376\376\375\377\376\376\375\376"..., width=2480, height=<optimized out>, dstProfile=<optimized out>, 
    renderingIntent=KoColorConversionTransformation::IntentPerceptual, conversionFlags=...)
    at /home/halla/dev/5.2/libs/pigment/KoColorSpace.cpp:868
Comment 3 Bug Janitor Service 2024-08-05 09:54:12 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/krita/-/merge_requests/2212
Comment 4 Dmitry Kazakov 2024-08-07 09:34:35 UTC
Git commit 207038fc5829d39eca41a1bb5d2ab814a7bb8e8a by Dmitry Kazakov, on behalf of Rasyuqa A. H..
Committed on 07/08/2024 at 09:33.
Pushed by dkazakov into branch 'master'.

WebP: fix colorspace export issue when dithering is enabled

M  +2    -2    plugins/impex/webp/kis_webp_export.cpp

https://invent.kde.org/graphics/krita/-/commit/207038fc5829d39eca41a1bb5d2ab814a7bb8e8a
Comment 5 Dmitry Kazakov 2024-08-07 09:35:39 UTC
Git commit 25ec1bf7fac79f2c3766969871666823a69a70e4 by Dmitry Kazakov, on behalf of Rasyuqa A. H..
Committed on 07/08/2024 at 09:35.
Pushed by dkazakov into branch 'krita/5.2'.

WebP: fix colorspace export issue when dithering is enabled

M  +2    -2    plugins/impex/webp/kis_webp_export.cpp

https://invent.kde.org/graphics/krita/-/commit/25ec1bf7fac79f2c3766969871666823a69a70e4