Bug 515714 - Krita segfault on opening avif files in kritaplugins/kritaheifimport.so
Summary: Krita segfault on opening avif files in kritaplugins/kritaheifimport.so
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: File formats (other bugs)
Version First Reported In: 5.2.15
Platform: Debian stable Linux
: NOR normal
Target Milestone: ---
Assignee: Dmitry Kazakov
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2026-02-08 08:57 UTC by keeya
Modified: 2026-02-09 16:49 UTC (History)
3 users (show)

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


Attachments
Test photo originally saved in Krita 5.1.5 causing the crash now (1.70 MB, image/avif)
2026-02-08 08:57 UTC, keeya
Details

Note You need to log in before you can comment on or make changes to this bug.
Description keeya 2026-02-08 08:57:31 UTC
Created attachment 189353 [details]
Test photo originally saved in Krita 5.1.5 causing the crash now

SUMMARY
Krita crashes when I open one of my avif files. I first blamed the Debian bundled version but the current app image 5.2.15, also on a different system, causes the same crash.

I have attached a test file.

I see there is another report pointing to avif, but for me the current version still crashes and it had a different backtrace there.

This is from the backtrace I get for the appimage. Not really useful sadly, the Debian's bundled has the same library crash. But the attached file to the report should reproduce it.

Stack trace of thread 12157:
#0  0x00007fa2d41e86f4 n/a (/tmp/.mount_krita-gDpBiE/usr/lib/kritaplugins/kritaheifimport.so + 0x1126f4)
#1  0x00007fa2d40e490b n/a (/tmp/.mount_krita-gDpBiE/usr/lib/kritaplugins/kritaheifimport.so + 0xe90b)
#2  0x00007fa2d40e1f7a n/a (/tmp/.mount_krita-gDpBiE/usr/lib/kritaplugins/kritaheifimport.so + 0xbf7a)
#3  0x00007fa2f6ab6efe n/a (/tmp/.mount_krita-gDpBiE/usr/lib/libkritaui.so.19.0.0 + 0x8b6efe)
#4  0x000055ccd10096a0 n/a (n/a + 0x0)

STEPS TO REPRODUCE
1. Open the attached .avif in Krita

OBSERVED RESULT
Krita segfaults

EXPECTED RESULT
Krita opens the file

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Debian GNU/Linux 13
KDE Plasma Version: 6.3.6
KDE Frameworks Version: 6.13.0
Qt Version: 6.8.2

ADDITIONAL INFORMATION
The crash does not happen in 5.1.5 app image, the Debian 12 version, nor the 5.2.0 app image. I did not test more versions.
Comment 1 kde 2026-02-08 09:19:27 UTC
I can observe the same issue in AppImage Krita 6.0.0-beta1 (git db05298) on Debian Trixie. Segmentation fault when opening the attached avif file. Different file from internet doesn't crash, but open blank canvas instead. Backtrace of the crash:

#0  0x00007fffe41e4969 in void Planar::readLayerImpl::create<xsimd::fma3<xsimd::avx2> >(int, LinearizePolicy, bool, bool, int, int, unsigned char const*, int, unsigned charconst*, int, unsigned char const*, int, unsigned char const*, int, KisSharedPtr<KisHLineIteratorNG>, float, float, KoColorSpace const*) () from /tmp/.mount_krita.EbaBlf/usr/lib/kritaplugins/kritaheifimport.so
#1  0x00007fffe40e37d5 in auto createOptimizedClass<Planar::readLayerImpl, int const&, LinearizePolicy&, bool&, bool&, int const&, int const&, unsigned char const*&, int const&, unsigned char const*&, int const&, unsigned char const*&, int const&, unsigned char const*&, int const&, KisSharedPtr<KisHLineIteratorNG>&, float&, float&, KoColorSpace const*&>(int const&, LinearizePolicy&, bool&, bool&, int const&, int const&, unsigned char const*&, int const&, unsigned char const*&, int const&, unsigned char const*&, int const&, unsigned char const*&, int const&, KisSharedPtr<KisHLineIteratorNG>&, float&, float&, KoColorSpace const*&) () from /tmp/.mount_krita.EbaBlf/usr/lib/kritaplugins kritaheifimport.so
#2  0x00007fffe40e0b68 in HeifImport::convert(KisDocument*, QIODevice*, KisPinnedSharedPtr<KisPropertiesConfiguration>) ()
   from /tmp/.mount_krita.EbaBlf/usr/lib/kritaplugins/kritaheifimport.so
#3  0x00007ffff7bc1c9e in KisImportExportManager::doImport(QString const&, QSharedPointer<KisImportExportFilter>) ()
   from /tmp/.mount_krita.EbaBlf/usr/bin/../lib/libkritaui.so.21
#4  0x00007ffff7bc3607 in KisImportExportManager::convert(KisImportExportManager::Direction, QString const&, QString const&, QString const&, bool, KisPinnedSharedPtr<KisPropertiesConfiguration>, bool, bool) () from /tmp/.mount_krita.EbaBlf/usr/bin/../lib/libkritaui.so.21
#5  0x00007ffff7bc441d in KisImportExportManager::importDocument(QString const&, QString const&) ()
   from /tmp/.mount_krita.EbaBlf/usr/bin/../lib/libkritaui.so.21
#6  0x00007ffff7ba4a45 in KisDocument::openFile() () from /tmp/.mount_krita.EbaBlf/usr/bin/../lib/libkritaui.so.21
#7  0x00007ffff7ba586e in KisDocument::openPathInternal(QString const&) () from /tmp/.mount_krita.EbaBlf/usr/bin/../lib/libkritaui.so.21
#8  0x00007ffff7baf5d8 in KisDocument::openPath(QString const&, QFlags<KisDocument::OpenFlag>) ()
   from /tmp/.mount_krita.EbaBlf/usr/bin/../lib/libkritaui.so.21
#9  0x00007ffff7bd722f in KisMainWindow::openDocumentInternal(QString const&, QFlags<KisMainWindow::OpenFlag>) ()
   from /tmp/.mount_krita.EbaBlf/usr/bin/../lib/libkritaui.so.21
#10 0x00007ffff7bd7ab6 in KisMainWindow::openDocument(QString const&, QFlags<KisMainWindow::OpenFlag>) ()
   from /tmp/.mount_krita.EbaBlf/usr/bin/../lib/libkritaui.so.21
#11 0x00007ffff7883a3f in KisWelcomePageWidget::dropEvent(QDropEvent*) () from /tmp/.mount_krita.EbaBlf/usr/bin/../lib/libkritaui.so.21
#12 0x00007ffff5fed7b0 in QWidget::event(QEvent*) () from /tmp/.mount_krita.EbaBlf/usr/bin/../lib/libQt6Widgets.so.6
#13 0x00007ffff5f8e735 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /tmp/.mount_krita.EbaBlf/usr/bin/../lib/libQt6Widgets.so.6
#14 0x00007ffff5f97f4e in QApplication::notify(QObject*, QEvent*) () from /tmp/.mount_krita.EbaBlf/usr/bin/../lib/libQt6Widgets.so.6
#15 0x00007ffff7b8a89e in KisApplication::notify(QObject*, QEvent*) () from /tmp/.mount_krita.EbaBlf/usr/bin/../lib/libkritaui.so.21
#16 0x00007ffff4d87258 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /tmp/.mount_krita.EbaBlf/usr/bin/../lib/libQt6Core.so.6
#17 0x00007ffff600436c in QWidgetWindow::handleDropEvent(QDropEvent*) () from /tmp/.mount_krita.EbaBlf/usr/bin/../lib/libQt6Widgets.so.6
#18 0x00007ffff600504c in QWidgetWindow::event(QEvent*) () from /tmp/.mount_krita.EbaBlf/usr/bin/../lib/libQt6Widgets.so.6
#19 0x00007ffff5f8e735 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /tmp/.mount_krita.EbaBlf/usr/bin/../lib/libQt6Widgets.so.6
#20 0x00007ffff7b8a89e in KisApplication::notify(QObject*, QEvent*) () from /tmp/.mount_krita.EbaBlf/usr/bin/../lib/libkritaui.so.21
#21 0x00007ffff4d87258 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /tmp/.mount_krita.EbaBlf/usr/bin/../lib/libQt6Core.so.6
#22 0x00007ffff55be428 in QGuiApplicationPrivate::processDrop(QWindow*, QMimeData const*, QPoint const&, QFlags<Qt::DropAction>, QFlags<Qt::MouseButton>, QFlags<Qt::KeyboardModifier>) () from /tmp/.mount_krita.EbaBlf/usr/bin/../lib/libQt6Gui.so.6
#23 0x00007ffff561d685 in QWindowSystemInterface::handleDrop(QWindow*, QMimeData const*, QPoint const&, QFlags<Qt::DropAction>, QFlags<Qt::MouseButton>, QFlags<Qt::KeyboardModifier>) () from /tmp/.mount_krita.EbaBlf/usr/bin/../lib/libQt6Gui.so.6
#24 0x00007fffeedcb5ca in QXcbDrag::handleDrop(QPlatformWindow*, xcb_client_message_event_t const*, QFlags<Qt::MouseButton>, QFlags<Qt::KeyboardModifier>)
    () from /tmp/.mount_krita.EbaBlf/usr/plugins/platforms/../../lib/libQt6XcbQpa.so.6
#25 0x00007fffeed81058 in QXcbConnection::handleXcbEvent(xcb_generic_event_t*) ()
   from /tmp/.mount_krita.EbaBlf/usr/plugins/platforms/../../lib/libQt6XcbQpa.so.6
#26 0x00007fffeed82286 in QXcbConnection::processXcbEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /tmp/.mount_krita.EbaBlf/usr/plugins/platforms/../../lib/libQt6XcbQpa.so.6
#27 0x00007fffeeda0d17 in xcbSourceDispatch(_GSource*, int (*)(void*), void*) () from /tmp/.mount_krita.EbaBlf/usr/plugins/platforms/../../lib/libQt6XcbQpa.so.6
#28 0x00007ffff25c5d3b in g_main_context_dispatch () from /tmp/.mount_krita.EbaBlf/usr/bin/../lib/libglib-2.0.so.0
#29 0x00007ffff261b2b8 in ?? () from /tmp/.mount_krita.EbaBlf/usr/bin/../lib/libglib-2.0.so.0
#30 0x00007ffff25c33e3 in g_main_context_iteration () from /tmp/.mount_krita.EbaBlf/usr/bin/../lib/libglib-2.0.so.0
#31 0x00007ffff5061480 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /tmp/.mount_krita.EbaBlf/usr/bin/../lib/libQt6Core.so.6
#32 0x00007ffff4d93bb2 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /tmp/.mount_krita.EbaBlf/usr/bin/../lib/libQt6Core.so.6
#33 0x00007ffff4d8f786 in QCoreApplication::exec() () from /tmp/.mount_krita.EbaBlf/usr/bin/../lib/libQt6Core.so.6
#34 0x000055555555d275 in main ()
Comment 2 Freya Lupen 2026-02-08 15:06:01 UTC
Confirming the attachment crashes and another HEIF file is blank (transparent), on 5.3.0/6.0.0-beta1. It appears to be caused somehow by "Update libheif-related deps" (https://invent.kde.org/packaging/krita-deps-management/-/merge_requests/73).

Enabling the "File loading and saving" debug category shows on my blank file
> krita.file: loading heif 0 1 8
compared to a version without these updated deps showing
> krita.file: loading heif 1 3 8
which means it's reading a RGB chroma_444 file as YCbCr chroma_420, explaining why it's completely broken.
Comment 3 Dmitry Kazakov 2026-02-09 16:48:49 UTC
Git commit 70631e374b032004921af6d834ae82434994a0b7 by Dmitry Kazakov.
Committed on 09/02/2026 at 16:48.
Pushed by dkazakov into branch 'master'.

Fix crashing when opening HEIF/AVIF images in YCrBr

We cannot read YCrBr images directly, we need to read them as RGB
data. Newer versions of libheif prefer YCrBr over RGB, so we should
request that explicitly.
Related: bug 515704

M  +6    -1    plugins/impex/heif/HeifImport.cpp

https://invent.kde.org/graphics/krita/-/commit/70631e374b032004921af6d834ae82434994a0b7
Comment 4 Dmitry Kazakov 2026-02-09 16:49:26 UTC
Git commit 2cf454423c04afa4c986b3df98b65a79b92fd505 by Dmitry Kazakov.
Committed on 09/02/2026 at 16:49.
Pushed by dkazakov into branch 'krita/6.0'.

Fix crashing when opening HEIF/AVIF images in YCrBr

We cannot read YCrBr images directly, we need to read them as RGB
data. Newer versions of libheif prefer YCrBr over RGB, so we should
request that explicitly.
Related: bug 515704

M  +6    -1    plugins/impex/heif/HeifImport.cpp

https://invent.kde.org/graphics/krita/-/commit/2cf454423c04afa4c986b3df98b65a79b92fd505