Bug 428349 - (Old version of) Filter mask with color adjustment crashes Krita in lcms
Summary: (Old version of) Filter mask with color adjustment crashes Krita in lcms
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Color models (show other bugs)
Version: 4.4.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-10-27 16:11 UTC by Tiar
Modified: 2021-09-27 15:45 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Test file (3.12 MB, application/x-krita)
2020-10-27 16:13 UTC, Tiar
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tiar 2020-10-27 16:11:37 UTC
SUMMARY
If you open some specific old files, they crash in lcms on the filer mask with color adjustment.


STEPS TO REPRODUCE
1. Open Krita.
2. Open the attached file.

OBSERVED RESULT
Crash

EXPECTED RESULT
No crash

ADDITIONAL INFORMATION
Note 1: It's not caused by the fact it's CMYK; (1) you can make and save and open a CMYK file in Krita 4.4.0 with color adjustment curves mask, even with Hue, Saturation and Lightness curves changed.

Note 2: I was checking versions 3.3.3, 4.0.4, 4.1.7 and later. It worked in 4.0.4, but crashed in 4.1.7. However if I open it in 4.0.4 and save under a new name, it still cannot be opened in 4.1.7, which means it was a regression 4.0.4 -> 4.1.7. which went uncaught and still crashes.


CRASH LOG
Thread 39 "Thread (pooled)" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffbbfff700 (LWP 26784)]
0x00007fffc2f059fb in ?? () from /usr/lib/x86_64-linux-gnu/liblcms2.so.2
(gdb) bt
#0  0x00007fffc2f059fb in  () at /usr/lib/x86_64-linux-gnu/liblcms2.so.2
#1  0x00007fffc309579c in LcmsColorSpace<KoCmykTraits<unsigned char> >::createPerChannelAdjustment(unsigned short const* const*) const (this=0x555559ad4710, transferValues=0x7fff903c1ad0)
    at /home/tymon/kritadev/krita/plugins/color/lcms2engine/LcmsColorSpace.h:347
#2  0x00007fffc2e5e797 in KisPerChannelFilter::createTransformation(KoColorSpace const*, KisPinnedSharedPtr<KisFilterConfiguration>) const (this=<optimized out>, cs=0x555559ad4710, config=...)
    at /home/tymon/kritadev/krita/plugins/filters/colorsfilters/kis_perchannel_filter.cpp:330
#3  0x00007ffff5b3cf0a in KisColorTransformationConfiguration::colorTransformation(KoColorSpace const*, KisColorTransformationFilter const*) const (this=0x5555678f4f70, cs=0x555559ad4710, filter=0x5555596e8790)
    at /usr/include/c++/8/bits/atomic_base.h:295
#4  0x00007ffff5b414ea in KisColorTransformationFilter::processImpl(KisSharedPtr<KisPaintDevice>, QRect const&, KisPinnedSharedPtr<KisFilterConfiguration>, KoUpdater*) const (this=0x5555596e8790, device=..., applyRect=..., config=..., progressUpdater=0x7fff900c2eb0) at /home/tymon/kritadev/krita/libs/global/kis_shared_ptr.h:179
#5  0x00007ffff5b38b7b in KisFilter::process(KisSharedPtr<KisPaintDevice>, KisSharedPtr<KisPaintDevice>, KisSharedPtr<KisSelection>, QRect const&, KisPinnedSharedPtr<KisFilterConfiguration>, KoUpdater*) const (this=0x5555596e8790, src=..., dst=..., selection=..., applyRect=..., config=..., progressUpdater=0x7fff900c2eb0) at /usr/include/c++/8/bits/atomic_base.h:295
#6  0x00007ffff5bfd6fd in KisFilterMask::decorateRect(KisSharedPtr<KisPaintDevice>&, KisSharedPtr<KisPaintDevice>&, QRect const&, KisNode::PositionToFilthy) const (this=<optimized out>, src=..., dst=..., rc=..., maskPos=<optimized out>)
    at /usr/include/c++/8/bits/atomic_base.h:295
#7  0x00007ffff5cbad0c in KisMask::mergeInMaskInternal(KisSharedPtr<KisPaintDevice>, KisSharedPtr<KisSelection>, QRect const&, QRect const&, KisNode::PositionToFilthy) const (this=0x55555e84d6b0, projection=..., effectiveSelection=..., applyRect=..., preparedNeedRect=..., maskPos=<optimized out>) at /home/tymon/kritadev/krita/libs/image/kis_mask.cc:340
#8  0x00007ffff5cbe081 in KisMask::apply(KisSharedPtr<KisPaintDevice>, QRect const&, QRect const&, KisNode::PositionToFilthy) const (this=0x55555e84d6b0, projection=..., applyRect=..., needRect=..., maskPos=KisNode::N_ABOVE_FILTHY)
    at /usr/include/c++/8/bits/atomic_base.h:295
#9  0x00007ffff5c92dde in KisLayer::applyMasks(KisSharedPtr<KisPaintDevice>, KisSharedPtr<KisPaintDevice>, QRect const&, KisSharedPtr<KisNode>, KisSharedPtr<KisNode>) const (this=0x55555ddff8c0, source=..., destination=..., requestedRect=..., filthyNode=..., lastNode=...) at /usr/include/c++/8/bits/atomic_base.h:295
#10 0x00007ffff5c931d2 in KisLayer::updateProjection(QRect const&, KisSharedPtr<KisNode>) (this=0x55555ddff8c0, rect=..., filthyNode=...) at /usr/include/c++/8/bits/atomic_base.h:295
#11 0x00007ffff5c98239 in KisLayerProjectionPlane::recalculate(QRect const&, KisSharedPtr<KisNode>) (this=<optimized out>, rect=..., filthyNode=...) at /usr/include/c++/8/bits/atomic_base.h:295
#12 0x00007ffff5c27670 in KisAsyncMerger::startMerge(KisBaseRectsWalker&, bool) (this=0x55555c189408, walker=..., notifyClones=<optimized out>) at /usr/include/c++/8/bits/atomic_base.h:295
#13 0x00007ffff5e83740 in non-virtual thunk to KisUpdateJobItem::run() () at /usr/include/x86_64-linux-gnu/qt5/QtCore/qarraydata.h:234
#14 0x00007ffff4663f71 in  () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#15 0x00007ffff466bc87 in  () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#16 0x00007ffff1a3a182 in start_thread (arg=<optimized out>) at pthread_create.c:486
#17 0x00007ffff3f3ab1f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95



SOFTWARE/OS VERSIONS
Krita

 Version: 4.4.0 (appimage)
 Languages: en_US, en, en_US, en, en_US, en, pl_PL, pl, pl_PL, pl
 Hidpi: true

Qt

  Version (compiled): 5.12.9
  Version (loaded): 5.12.9
Comment 1 Tiar 2020-10-27 16:13:34 UTC
Created attachment 132799 [details]
Test file
Comment 2 Tiar 2020-11-18 16:06:21 UTC
It has a crash log, so it's confirmed.
Comment 3 wolthera 2021-09-27 15:44:31 UTC
Git commit 8218dcd6cd6b40e4da31d2f6f179c597c3c1a9be by Wolthera van Hövell tot Westerflier.
Committed on 27/09/2021 at 15:40.
Pushed by woltherav into branch 'krita/5.0'.

Ensure the amount of curves passed for per channel is not too low.

It seems we may have had a period where too few curves were stored
in the config. This commit appends identity curves for the missing
entries, avoiding crashes.
Related: bug 411917

M  +9    -1    plugins/filters/colorsfilters/kis_perchannel_filter.cpp

https://invent.kde.org/graphics/krita/commit/8218dcd6cd6b40e4da31d2f6f179c597c3c1a9be
Comment 4 wolthera 2021-09-27 15:45:03 UTC
Git commit 2a5cf5d3458aed467c2683947403edc2ce06aa5b by Wolthera van Hövell, on behalf of Wolthera van Hövell tot Westerflier.
Committed on 27/09/2021 at 15:44.
Pushed by woltherav into branch 'master'.

Ensure the amount of curves passed for per channel is not too low.

It seems we may have had a period where too few curves were stored
in the config. This commit appends identity curves for the missing
entries, avoiding crashes.
Related: bug 411917


(cherry picked from commit 8218dcd6cd6b40e4da31d2f6f179c597c3c1a9be)

M  +9    -1    plugins/filters/colorsfilters/kis_perchannel_filter.cpp

https://invent.kde.org/graphics/krita/commit/2a5cf5d3458aed467c2683947403edc2ce06aa5b