Bug 506168 - 88295ba7c35eca7e668d48e02e7b752828832454 crashing with AVIF HDR file, but PNG equivalent loads fine
Summary: 88295ba7c35eca7e668d48e02e7b752828832454 crashing with AVIF HDR file, but PNG...
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: File formats (other bugs)
Version First Reported In: git master (please specify the git hash!)
Platform: Compiled Sources Linux
: NOR crash
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords: release_blocker
Depends on:
Blocks:
 
Reported: 2025-06-25 15:08 UTC by Kyle Devir
Modified: 2025-10-06 14:04 UTC (History)
3 users (show)

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


Attachments
Broken AVIF file (1.23 MB, image/avif)
2025-06-25 15:09 UTC, Kyle Devir
Details
Working PNG file (1.36 MB, image/png)
2025-06-25 15:09 UTC, Kyle Devir
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kyle Devir 2025-06-25 15:08:26 UTC
I tried opening a HDR AVIF file, but Krita immediately crashes, without a useful backtrace.

I converted it to PNG with Gwenview, and Krita opens that just fine.

Will attach both for testing.
Comment 1 Kyle Devir 2025-06-25 15:09:06 UTC
Created attachment 182654 [details]
Broken AVIF file
Comment 2 Kyle Devir 2025-06-25 15:09:29 UTC
Created attachment 182655 [details]
Working PNG file
Comment 3 Kyle Devir 2025-06-27 07:59:20 UTC
Managed to get a backtrace:

#0  Planar::value<xsimd::fma3<xsimd::avx2>, 12, (LinearizePolicy)0, 0> (img=<optimized out>, stride=<optimized out>, x=<optimized out>, y=<optimized out>) at /usr/src/debug/krita-qt6-git/build/plugins/impex/heif/kis_heif_import_tools_AVX2+FMA.cpp:80
#1  Planar::readLayer<xsimd::fma3<xsimd::avx2>, 12, (LinearizePolicy)0, true, false>(int, int, unsigned char const*, int, unsigned char const*, int, unsigned char const*, int, unsigned char const*, int, KisSharedPtr<KisHLineIteratorNG>, float, float, KoColorSpace const*) [clone .isra.0] (width=3840, height=2160, imgR=0x0, strideR=strideR@entry=0, imgG=imgG@entry=0x0, strideG=strideG@entry=0, imgB=0x0, strideB=0, it=..., colorSpace=0x5b7107ccc0d0, displayNits=<optimized out>, displayGamma=<optimized out>, strideA=<optimized out>, imgA=<optimized out>) at /usr/src/debug/krita-qt6-git/build/plugins/impex/heif/kis_heif_import_tools_AVX2+FMA.cpp:174
#2  0x00007b27dd9d6a87 in Planar::readPlanarLayerWithLuma<xsimd::fma3<xsimd::avx2>, 12, 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*&> (linearizePolicy=<optimized out>) at /usr/src/debug/krita-qt6-git/build/plugins/impex/heif/kis_heif_import_tools_AVX2+FMA.cpp:220
#3  0x00007b27dd9e0184 in Planar::readLayerImpl::create<xsimd::fma3<xsimd::avx2> >(int, LinearizePolicy, bool, bool, int, int, unsigned char const*, int, unsigned char const*, int, unsigned char const*, int, unsigned char const*, int, KisSharedPtr<KisHLineIteratorNG>, float, float, KoColorSpace const*) [clone .isra.0] (luma=<optimized out>, policy=<optimized out>, applyOOTF=<optimized out>, hasAlpha=<optimized out>, width=<optimized out>, height=<optimized out>, imgR=<optimized out>, strideR=<optimized out>, imgG=<optimized out>, strideG=<optimized out>, imgB=<optimized out>, strideB=<optimized out>, imgA=<optimized out>, strideA=<optimized out>, displayGamma=1.20000005, displayNits=1000, colorSpace=0x5b7107ccc0d0, it=...) at /usr/src/debug/krita-qt6-git/build/plugins/impex/heif/kis_heif_import_tools_AVX2+FMA.cpp:312
#4  0x00007b27dd95fad8 in 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*&> () at /usr/src/debug/krita-qt6-git/krita/libs/multiarch/KoMultiArchBuildSupport.h:49
#5  0x00007b27dd965b81 in Planar::readPlanarLayer (luma=<optimized out>, policy=<optimized out>, applyOOTF=<optimized out>, hasAlpha=<optimized out>, width=<optimized out>, height=<optimized out>, imgR=<optimized out>, strideR=<optimized out>, imgG=<optimized out>, strideG=<optimized out>, imgB=<optimized out>, strideB=<optimized out>, imgA=<optimized out>, strideA=<optimized out>, it=..., displayGamma=<optimized out>, displayNits=<optimized out>, colorSpace=<optimized out>) at /usr/src/debug/krita-qt6-git/krita/plugins/impex/heif/HeifImport.cpp:129
#6  HeifImport::convert (this=<optimized out>, document=0x5b7111701350, io=<optimized out>) at /usr/src/debug/krita-qt6-git/krita/plugins/impex/heif/HeifImport.cpp:422
#7  0x00007b2866a1373f in KisImportExportManager::doImport (this=this@entry=0x5b710c58f400, location=..., filter=...) at /usr/src/debug/krita-qt6-git/krita/libs/ui/KisImportExportManager.cpp:743
#8  0x00007b2866a1527e in KisImportExportManager::convert (this=0x5b710c58f400, direction=direction@entry=KisImportExportManager::Import, location=..., realLocation=<optimized out>, mimeType=<optimized out>, showWarnings=false, exportConfiguration=..., isAsync=false, isAdvancedExporting=false) at /usr/src/debug/krita-qt6-git/krita/libs/ui/KisImportExportManager.cpp:404
#9  0x00007b2866a1614b in KisImportExportManager::importDocument (this=<optimized out>, location=<optimized out>, mimeType=<optimized out>) at /usr/src/debug/krita-qt6-git/krita/libs/ui/KisImportExportManager.cpp:160
#10 0x00007b2866a05e4d in KisDocument::openFile (this=this@entry=0x5b7111701350) at /usr/src/debug/krita-qt6-git/krita/libs/ui/KisDocument.cpp:1996
#11 0x00007b2866a06d0e in KisDocument::openPathInternal (this=this@entry=0x5b7111701350, path=...) at /usr/src/debug/krita-qt6-git/krita/libs/ui/KisDocument.cpp:2576
#12 0x00007b2866a071ac in KisDocument::openPath (this=0x5b7111701350, _path=..., flags=...) at /usr/src/debug/krita-qt6-git/krita/libs/ui/KisDocument.cpp:1932
#13 0x00007b2866a19841 in KisMainWindow::openDocumentInternal (this=this@entry=0x5b71045b9c30, path=..., flags=..., flags@entry=...) at /usr/src/debug/krita-qt6-git/krita/libs/ui/KisMainWindow.cpp:1072
#14 0x00007b2866a19fe2 in KisMainWindow::openDocument (this=0x5b71045b9c30, path=..., flags=...) at /usr/src/debug/krita-qt6-git/krita/libs/ui/KisMainWindow.cpp:1046
#15 0x00007b286678a560 in KisWelcomePageWidget::recentDocumentClicked (this=0x5b7103e714f0, index=...) at /usr/src/debug/krita-qt6-git/krita/libs/ui/KisWelcomePageWidget.cpp:656
#16 0x00007b2866515fcf in KisWelcomePageWidget::qt_static_metacall (_o=<optimized out>, _c=<optimized out>, _id=<optimized out>, _a=<optimized out>) at /usr/src/debug/krita-qt6-git/build/libs/ui/kritaui_autogen/EWIEGA46WW/moc_KisWelcomePageWidget.cpp:215
#17 0x00007b28641d3b8a in doActivate<false> (sender=<optimized out>, signal_index=<optimized out>, argv=<optimized out>) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qobject.cpp:4158
#18 0x00007b286562ed42 in QMetaObject::activate<void, QModelIndex> (sender=0x5b71045b8810, mo=<optimized out>, local_signal_index=1, ret=0x0, sender=<optimized out>, mo=<optimized out>, local_signal_index=<optimized out>, ret=<optimized out>) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qobjectdefs.h:306
#19 QAbstractItemView::clicked (this=0x5b71045b8810, _t1=...) at /usr/src/debug/qt6-base/build/src/widgets/Widgets_autogen/include/moc_qabstractitemview.cpp:552
#20 QAbstractItemView::mouseReleaseEvent (this=0x5b71045b8810, event=0x7ffc5d8c16f0) at /usr/src/debug/qt6-base/qtbase/src/widgets/itemviews/qabstractitemview.cpp:1976
#21 0x00007b28656797e8 in QListView::mouseReleaseEvent (this=0x5b71045b8810, e=<optimized out>) at /usr/src/debug/qt6-base/qtbase/src/widgets/itemviews/qlistview.cpp:770
#22 0x00007b286535b6c7 in QWidget::event (this=0x5b71045b8810, event=0x7ffc5d8c16f0) at /usr/src/debug/qt6-base/qtbase/src/widgets/kernel/qwidget.cpp:8987
#23 0x00007b28653c7a76 in QFrame::event (this=0x5b71045b8810, e=0x7ffc5d8c16f0) at /usr/src/debug/qt6-base/qtbase/src/widgets/widgets/qframe.cpp:521
#24 0x00007b28641675dc in QCoreApplicationPrivate::sendThroughObjectEventFilters (receiver=receiver@entry=0x5b71045d9390, event=event@entry=0x7ffc5d8c16f0) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qcoreapplication.cpp:1243
#25 0x00007b2865301c60 in QApplicationPrivate::notify_helper (this=this@entry=0x5b71040e5110, receiver=receiver@entry=0x5b71045d9390, e=e@entry=0x7ffc5d8c16f0) at /usr/src/debug/qt6-base/qtbase/src/widgets/kernel/qapplication.cpp:3297
#26 0x00007b2865305c39 in QApplication::notify (this=this@entry=0x7ffc5d8c2780, receiver=receiver@entry=0x5b71045d9390, e=e@entry=0x7ffc5d8c16f0) at /usr/src/debug/qt6-base/qtbase/src/widgets/kernel/qapplication.cpp:2780
#27 0x00007b28669e855f in KisApplication::notify (this=0x7ffc5d8c2780, receiver=0x5b71045d9390, event=0x7ffc5d8c16f0) at /usr/src/debug/krita-qt6-git/krita/libs/ui/KisApplication.cpp:817
#28 0x00007b2864168118 in QCoreApplication::notifyInternal2 (receiver=0x5b71045d9390, event=0x7ffc5d8c16f0) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qcoreapplication.cpp:1106
#29 0x00007b286416816d in QCoreApplication::sendSpontaneousEvent (receiver=<optimized out>, event=<optimized out>) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qcoreapplication.cpp:1560
#30 0x00007b28652f7398 in QApplicationPrivate::sendMouseEvent (receiver=0x5b71045d9390, event=0x7ffc5d8c16f0, alienWidget=<optimized out>, nativeWidget=0x5b71045b9c30, buttonDown=0x7b28659486b0 <qt_button_down>, lastMouseReceiver=..., spontaneous=true, onlyDispatchEnterLeave=false) at /usr/src/debug/qt6-base/qtbase/src/widgets/kernel/qapplication.cpp:2361
#31 0x00007b2865376f13 in QWidgetWindow::handleMouseEvent (this=0x5b710783b5d0, event=event@entry=0x7ffc5d8c1b70) at /usr/src/debug/qt6-base/qtbase/src/widgets/kernel/qwidgetwindow.cpp:669
#32 0x00007b28653781d8 in QWidgetWindow::event (this=<optimized out>, event=0x7ffc5d8c1b70) at /usr/src/debug/qt6-base/qtbase/src/widgets/kernel/qwidgetwindow.cpp:292
#33 0x00007b2865301c70 in QApplicationPrivate::notify_helper (this=this@entry=0x5b710783b5d0, receiver=0x5b710783b5d0, e=0x7ffc5d8c1b70) at /usr/src/debug/qt6-base/qtbase/src/widgets/kernel/qapplication.cpp:3303
#34 0x00007b2865304f83 in QApplication::notify (this=this@entry=0x7ffc5d8c2780, receiver=receiver@entry=0x5b710783b5d0, e=e@entry=0x7ffc5d8c1b70) at /usr/src/debug/qt6-base/qtbase/src/widgets/kernel/qapplication.cpp:3064
#35 0x00007b28669e855f in KisApplication::notify (this=0x7ffc5d8c2780, receiver=0x5b710783b5d0, event=0x7ffc5d8c1b70) at /usr/src/debug/krita-qt6-git/krita/libs/ui/KisApplication.cpp:817
#36 0x00007b2864168118 in QCoreApplication::notifyInternal2 (receiver=0x5b710783b5d0, event=0x7ffc5d8c1b70) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qcoreapplication.cpp:1106
#37 0x00007b286416816d in QCoreApplication::sendSpontaneousEvent (receiver=<optimized out>, event=<optimized out>) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qcoreapplication.cpp:1560
#38 0x00007b28649a1217 in QGuiApplicationPrivate::processMouseEvent (e=0x5b711716ebb0) at /usr/src/debug/qt6-base/qtbase/src/gui/kernel/qguiapplication.cpp:2476
#39 0x00007b2864a248f4 in QWindowSystemInterface::sendWindowSystemEvents (flags=...) at /usr/src/debug/qt6-base/qtbase/src/gui/kernel/qwindowsysteminterface.cpp:1113
#40 0x00007b2864a13b27 in QWindowSystemInterface::flushWindowSystemEvents (flags=...) at /usr/src/debug/qt6-base/qtbase/src/gui/kernel/qwindowsysteminterface.cpp:1082
#41 0x00007b28641c0e34 in QObject::event (this=<optimized out>, e=<optimized out>) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qobject.cpp:1431
#42 0x00007b2865301c70 in QApplicationPrivate::notify_helper (this=this@entry=0x5b7103bc3290, receiver=0x5b7104056a60, e=0x7b28500069b0) at /usr/src/debug/qt6-base/qtbase/src/widgets/kernel/qapplication.cpp:3303
#43 0x00007b2865304f83 in QApplication::notify (this=this@entry=0x7ffc5d8c2780, receiver=receiver@entry=0x5b7104056a60, e=e@entry=0x7b28500069b0) at /usr/src/debug/qt6-base/qtbase/src/widgets/kernel/qapplication.cpp:3064
#44 0x00007b28669e855f in KisApplication::notify (this=0x7ffc5d8c2780, receiver=0x5b7104056a60, event=0x7b28500069b0) at /usr/src/debug/krita-qt6-git/krita/libs/ui/KisApplication.cpp:817
#45 0x00007b2864168118 in QCoreApplication::notifyInternal2 (receiver=0x5b7104056a60, event=event@entry=0x7b28500069b0) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qcoreapplication.cpp:1106
#46 0x00007b28641684fb in QCoreApplication::sendEvent (receiver=<optimized out>, event=0x7b28500069b0) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qcoreapplication.cpp:1546
#47 QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0x5b7103918370) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qcoreapplication.cpp:1879
#48 0x00007b286443fcf8 in QCoreApplication::sendPostedEvents (receiver=0x0, event_type=0) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qcoreapplication.cpp:1733
#49 postEventSourceDispatch (s=0x5b71042f1280) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qeventdispatcher_glib.cpp:246
#50 0x00007b28619c787d in g_main_dispatch (context=0x5b7103bc06f0) at ../glib/glib/gmain.c:3398
#51 0x00007b28619c8cd7 in g_main_context_dispatch_unlocked (context=0x5b7103bc06f0) at ../glib/glib/gmain.c:4249
#52 g_main_context_iterate_unlocked (context=context@entry=0x5b7103bc06f0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/glib/gmain.c:4314
#53 0x00007b28619c8ee5 in g_main_context_iteration (context=0x5b7103bc06f0, may_block=1) at ../glib/glib/gmain.c:4379
#54 0x00007b286443c5e2 in QEventDispatcherGlib::processEvents (this=0x5b7103c9af00, flags=...) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qeventdispatcher_glib.cpp:399
#55 0x00007b28641744b6 in QEventLoop::processEvents (this=0x7ffc5d8c23a0, flags=...) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qeventloop.cpp:104
#56 QEventLoop::exec (this=0x7ffc5d8c23a0, flags=...) at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qeventloop.cpp:186
#57 0x00007b286416c7c1 in QCoreApplication::exec () at /usr/src/debug/qt6-base/qtbase/src/corelib/kernel/qcoreapplication.cpp:1449
#58 0x00007b28652fc6aa in QApplication::exec () at /usr/src/debug/qt6-base/qtbase/src/widgets/kernel/qapplication.cpp:2570
#59 0x00005b70ecad86d9 in main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/krita-qt6-git/krita/krita/main.cc:778
Comment 4 Halla Rempt 2025-07-08 09:28:20 UTC
Thansk for the report. I can confirm the crash, but only in a Qt6 build of Krita, not in a Qt5 build.
Comment 5 Dmitry Kazakov 2025-07-08 10:00:00 UTC
The problem is in this place:

QVector4D KisVisualColorModel::convertKoColorToChannelValues(KoColor c) const
{
    // <...cut...>
    if (m_d->exposureSupported) {
        channelValuesDisplay /= m_d->channelMaxValues;
    }
}

`channelMaxValues` and `channelValuesDisplay` have inconsistent sizes. The whole widget has inconsistent sizes actually. Some expect to have 4 channels all the time, some are dynamically resized according to the used color space.
Comment 6 Dmitry Kazakov 2025-10-06 14:04:02 UTC
Should be fixed in this branch: https://invent.kde.org/graphics/krita/-/merge_requests/2471