Bug 431665 - Wave Filter Crashes Krita on Wavelength 0
Summary: Wave Filter Crashes Krita on Wavelength 0
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Filters (show other bugs)
Version: 4.4.1
Platform: Microsoft Windows Microsoft Windows
: NOR crash
Target Milestone: ---
Assignee: Emmet O'Neill
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-15 22:39 UTC by staticlike
Modified: 2021-01-19 05:04 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description staticlike 2021-01-15 22:39:27 UTC
SUMMARY
Setting wavelength (for either direction) to 0 in the dialog for Filters > Other > Wave results in Krita immediately closing without a crash dialog.

STEPS TO REPRODUCE
1. Open an image or create a new one
2. Open the Filter > Other > Wave dialog
3. Input 0 into the wavelength field for either horizontal or vertical with preview on (Or attempt to apply the wave filter with wavelength 0 with preview off)

OBSERVED RESULT
Krita closes without a crash dialog

EXPECTED RESULT
Krita doesn't close

SOFTWARE/OS VERSIONS
Windows: 10
Krita: 4.4.1

ADDITIONAL INFORMATION
I imagine it's trying to do math where a 0 is very bad. Triangle wave seems to crash it faster than sinusoidal.
Comment 1 Halla Rempt 2021-01-16 12:08:49 UTC
Looks like there's a threading problem here:

ASSERT (krita): "hash != KeyTraits::NullHash" in file /home/boud/dev/4.3/libs/image/3rdparty/lock_free_map/leapfrog.h, line 161
ASSERT (krita): "hash != KeyTraits::NullHash" in file /home/boud/dev/4.3/libs/image/3rdparty/lock_free_map/leapfrog.h, line 161
ASSERT (krita): "hash != KeyTraits::NullHash" in file /home/boud/dev/4.3/libs/image/3rdparty/lock_free_map/leapfrog.h, line 161
ASSERT (krita): "hash != KeyTraits::NullHash" in file /home/boud/dev/4.3/libs/image/3rdparty/lock_free_map/leapfrog.h, line 161
ASSERT (krita): "hash != KeyTraits::NullHash" in file /home/boud/dev/4.3/libs/image/3rdparty/lock_free_map/leapfrog.h, line 161
ASSERT (krita): "hash != KeyTraits::NullHash" in file /home/boud/dev/4.3/libs/image/3rdparty/lock_free_map/leapfrog.h, line 161
ASSERT (krita): "hash != KeyTraits::NullHash" in file /home/boud/dev/4.3/libs/image/3rdparty/lock_free_map/leapfrog.h, line 161
ASSERT (krita): "hash != KeyTraits::NullHash" in file /home/boud/dev/4.3/libs/image/3rdparty/lock_free_map/leapfrog.h, line 161
--Type <RET> for more, q to quit, c to continue without paging--

Thread 62 "Thread (pooled)" received signal SIGABRT, Aborted.
[Switching to Thread 0x7fff354aa700 (LWP 1830658)]
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x00007ffff3f51859 in __GI_abort () at abort.c:79
#2  0x00007ffff43acbe7 in qt_message_fatal (context=..., message=<synthetic pointer>...)
    at global/qlogging.cpp:1914
#3  QMessageLogger::fatal (this=this@entry=0x7fff354a9790, msg=msg@entry=0x7ffff56a22a2 "%s")
    at global/qlogging.cpp:893
#4  0x00007ffff565586e in kis_assert_common (assertion=<optimized out>, file=<optimized out>, line=161, 
    throwException=<optimized out>, isIgnorable=<optimized out>)
    at /usr/include/x86_64-linux-gnu/qt5/QtCore/qarraydata.h:61
#5  0x00007ffff565a5f2 in kis_assert_recoverable (
    assertion=assertion@entry=0x7ffff5e2a36b "hash != KeyTraits::NullHash", 
    file=file@entry=0x7ffff5e2a300 "/home/boud/dev/4.3/libs/image/3rdparty/lock_free_map/leapfrog.h", 
    line=line@entry=161) at /home/boud/dev/4.3/libs/global/kis_assert.cpp:112
#6  0x00007ffff5a58834 in Leapfrog<ConcurrentMap<unsigned int, KisTile*, DefaultKeyTraits<unsigned int>, DefaultValueTraits<KisTile*> > >::find (table=0x7fff600719e0, hash=<optimized out>)
    at /home/boud/dev/4.3/libs/image/3rdparty/lock_free_map/leapfrog.h:157
#7  ConcurrentMap<unsigned int, KisTile*, DefaultKeyTraits<unsigned int>, DefaultValueTraits<KisTile*> >::get (
    key=<optimized out>, this=0x5555582e3ff0)
    at /home/boud/dev/4.3/libs/image/3rdparty/lock_free_map/concurrent_map.h:264
#8  KisTileHashTableTraits2<KisTile>::getReadOnlyTileLazy (this=0x5555582e3ff0, col=-33554432, row=-33554432, 
    existingTile=@0x7fff354a98a0: 128) at /home/boud/dev/4.3/libs/image/tiles3/kis_tile_hash_table2.h:390
#9  0x00007ffff5a70c0e in KisTiledDataManager::getTile (writable=<optimized out>, row=-33554432, col=-33554432, 
    this=0x5555582e5470) at /home/boud/dev/4.3/libs/image/tiles3/kis_tiled_data_manager.h:128
#10 KisTiledDataManager::getTilesPair (oldTile=0x7fff50021018, tile=0x7fff50021010, writable=<optimized out>, 
    row=-33554432, col=-33554432, this=0x5555582e5470)
    at /home/boud/dev/4.3/libs/image/tiles3/kis_tiled_data_manager.h:107
#11 KisRandomAccessor2::fetchTileData (this=0x7fff50036570, col=-33554432, row=-33554432)
    at /home/boud/dev/4.3/libs/image/tiles3/kis_random_accessor.cc:125
#12 0x00007ffff5a712c6 in KisRandomAccessor2::moveTo (this=0x7fff50036570, x=-2147483648, y=-2147483648)
    at /home/boud/dev/4.3/libs/image/tiles3/kis_random_accessor.cc:92
#13 0x00007ffff5d2d79a in KisRandomSubAccessor::sampledOldRawData (this=0x7fff5004f610, dst=0x7fff4ff449ac "")
    at /home/boud/dev/4.3/libs/global/kis_shared_ptr.h:179
#14 0x00007fffc7d9cbfd in KisFilterWave::processImpl (this=<optimized out>, device=..., applyRect=..., 
    config=..., progressUpdater=0x7fff5002b740) at /home/boud/dev/4.3/libs/image/kis_sequential_iterator.h:277
#15 0x00007ffff6ea8af6 in KisFilterStrokeStrategy::doStrokeCallback (this=0x55556546d3f0, data=<optimized out>)
    at /usr/include/c++/9/bits/atomic_base.h:318
#16 0x00007ffff5a4811b in KisStrokeJob::run (this=<optimized out>)
    at /home/boud/dev/4.3/libs/image/kis_stroke_job.h:44
#17 KisUpdateJobItem::run (this=0x55556020b8e0) at /home/boud/dev/4.3/libs/image/kis_update_job_item.h:102
#18 0x00007ffff43eafb2 in QThreadPoolThread::run (this=0x7fff680020f0) at thread/qthreadpool.cpp:100
#19 0x00007ffff43e7bac in QThreadPrivate::start (arg=0x7fff680020f0) at thread/qthread_unix.cpp:329
#20 0x00007ffff218f609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#21 0x00007ffff404e293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
(g
Comment 2 Emmet O'Neill 2021-01-19 04:45:15 UTC
Git commit 715bde764fe629ddc8041422c80e0f996d14fed4 by Emmet O'Neill.
Committed on 19/01/2021 at 04:42.
Pushed by emmetoneill into branch 'master'.

Fixed divide by zero crash in wavefilter.

M  +19   -8    plugins/filters/wavefilter/wavefilter.cpp

https://invent.kde.org/graphics/krita/commit/715bde764fe629ddc8041422c80e0f996d14fed4
Comment 3 Emmet O'Neill 2021-01-19 05:03:47 UTC
Git commit ff5927f0202e33b8bb0ae8555e6cc8c6afbf96bd by Emmet O'Neill.
Committed on 19/01/2021 at 05:03.
Pushed by emmetoneill into branch 'krita/4.3'.

Fixed divide by zero crash in wavefilter.


(cherry picked from commit 715bde764fe629ddc8041422c80e0f996d14fed4)

M  +19   -8    plugins/filters/wavefilter/wavefilter.cpp

https://invent.kde.org/graphics/krita/commit/ff5927f0202e33b8bb0ae8555e6cc8c6afbf96bd
Comment 4 Emmet O'Neill 2021-01-19 05:04:41 UTC
Git commit 3fd8365aa1279d9c8d919e8a53fc9b6db70af97b by Emmet O'Neill.
Committed on 19/01/2021 at 05:04.
Pushed by emmetoneill into branch 'krita/4.4.2'.

Fixed divide by zero crash in wavefilter.


(cherry picked from commit 715bde764fe629ddc8041422c80e0f996d14fed4)

M  +19   -8    plugins/filters/wavefilter/wavefilter.cpp

https://invent.kde.org/graphics/krita/commit/3fd8365aa1279d9c8d919e8a53fc9b6db70af97b