https://bugs.kde.org/show_bug.cgi?id=511184

            Bug ID: 511184
           Summary: Crash when confirming a face suggestion when Exiv2
                    reads 0x0 image size
    Classification: Applications
           Product: digikam
      Version First 8.8.0
       Reported In:
          Platform: Arch Linux
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: Thumbs-Engine
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

SUMMARY

When accepting a face suggestion, digiKam crashes. This is on a jxl file that
has been converted from a jpg file using `cjxl --num_threads=0 --effort=10
--lossless_jpeg=1`. Exiv2 reads a 0x0 image size that digiKam cannot handle.

STEPS TO REPRODUCE
1. Open the problematic image in digiKam (that has already been scanned for
faces).
2. Click confirm at a face suggestion

OBSERVED RESULT
A crash:

ASSERT failure in constexpr QtPrivate::QCheckedIntegers::QCheckedInt<int>
QtPrivate::QCheckedIntegers::operator+(QCheckedInt<int>, QCheckedInt<int>):
"Overflow in operator+", file /usr/include/qt6/QtCore/qcheckedint_impl.h, line
69

EXPECTED RESULT
Face is accepted

SOFTWARE/OS VERSIONS
Arch Linux (Wayland)
KDE Frameworks Version: 6.19.0
Qt Version: 6.10.0, built against 6.10.0

ADDITIONAL INFORMATION

The backtrace is:

#0  __pthread_kill_implementation (threadid=<optimized out>,
signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
#1  0x00007ffff3a98a13 in __pthread_kill_internal (threadid=<optimized out>,
signo=6) at pthread_kill.c:89
#2  0x00007ffff3a3e410 in __GI_raise (sig=sig@entry=6) at
../sysdeps/posix/raise.c:26
#3  0x00007ffff3a2557a in __GI_abort () at abort.c:77
#4  0x00007ffff429348c in qAbort () at
/usr/src/debug/qt6-base/qtbase/src/corelib/global/qassert.cpp:46
#5  qt_maybe_message_fatal<QString&> (msgType=QtFatalMsg, context=...,
message=...) at
/usr/src/debug/qt6-base/qtbase/src/corelib/global/qlogging.cpp:2165
#6  qt_message(QtMsgType, const QMessageLogContext &, const char *, typedef
__va_list_tag __va_list_tag *) (msgType=msgType@entry=QtFatalMsg, context=..., 
    msg=msg@entry=0x7ffff467a2b8 "ASSERT failure in %s: \"%s\", file %s, line
%d", ap=ap@entry=0x7ffd867f9d98) at
/usr/src/debug/qt6-base/qtbase/src/corelib/global/qlogging.cpp:412
#7  0x00007ffff4294250 in QMessageLogger::fatal (this=<optimized out>,
msg=0x7ffff467a2b8 "ASSERT failure in %s: \"%s\", file %s, line %d") at
/usr/src/debug/qt6-base/qtbase/src/corelib/global/qlogging.cpp:901
#8  0x00007ffff429197a in qt_assert_x (where=<optimized out>, what=<optimized
out>, file=file@entry=0x7ffff6d172b0
"/usr/include/qt6/QtCore/qcheckedint_impl.h", line=line@entry=69)
    at /usr/src/debug/qt6-base/qtbase/src/corelib/global/qassert.cpp:122
#9  0x00007ffff60c6954 in
QtPrivate::QCheckedIntegers::AssertReportPolicy::check(bool, char const*, char
const*) [clone .part.0] [clone .lto_priv.0] [clone .lto_priv.0]
(where=<optimized out>, 
    description=<optimized out>, ok=<optimized out>) at
/usr/include/qt6/QtCore/qcheckedint_impl.h:69
#10 0x00007ffff60f50cc in
QtPrivate::QCheckedIntegers::AssertReportPolicy::check (ok=<optimized out>,
where=<optimized out>, description=<optimized out>) at
/usr/include/qt6/QtCore/qrect.h:897
#11 QtPrivate::QCheckedIntegers::operator+ (lhs=..., rhs=...) at
/usr/include/qt6/QtCore/qcheckedint_impl.h:152
#12 QRect::QRect (this=<optimized out>, aleft=..., atop=..., awidth=...,
aheight=...) at /usr/include/qt6/QtCore/qrect.h:143
#13 QRect::QRect (this=<optimized out>, aleft=<optimized out>, atop=<optimized
out>, awidth=<optimized out>, aheight=<optimized out>) at
/usr/include/qt6/QtCore/qrect.h:167
#14 QRectF::toRect (this=0x7ffd867fa060) at /usr/include/qt6/QtCore/qrect.h:896
#15 0x00007ffff687a7df in Digikam::TagRegion::mapFromOriginalSize
(fullImageSize=..., reducedImageSize=..., fullSizeDetail=...) at
/usr/src/debug/digikam/digikam-8.8.0/core/libs/database/tags/tagregion.cpp:250
#16 0x00007ffff64d3d57 in Digikam::ThumbnailCreator::loadImageDetail
(this=this@entry=0x7ffdfc001810, info=..., metadata=..., detailRect=...,
profile=profile@entry=0x7ffd867fa200)
    at
/usr/src/debug/digikam/digikam-8.8.0/core/libs/threadimageio/thumb/thumbnailcreator_engine.cpp:307
#17 0x00007ffff64d895e in Digikam::ThumbnailCreator::createThumbnail
(this=this@entry=0x7ffdfc001810, info=..., detailRect=...)
    at
/usr/src/debug/digikam/digikam-8.8.0/core/libs/threadimageio/thumb/thumbnailcreator_engine.cpp:52
#18 0x00007ffff64d9a0f in Digikam::ThumbnailCreator::load (this=0x7ffdfc001810,
identifier=..., rect=..., pregenerate=pregenerate@entry=false,
onlyStorage=false)
    at
/usr/src/debug/digikam/digikam-8.8.0/core/libs/threadimageio/thumb/thumbnailcreator.cpp:276
#19 0x00007ffff64d9ca0 in Digikam::ThumbnailCreator::loadDetail
(this=<optimized out>, identifier=..., rect=..., onlyStorage=<optimized out>)
    at
/usr/src/debug/digikam/digikam-8.8.0/core/libs/threadimageio/thumb/thumbnailcreator.cpp:175
#20 0x00007ffff64ec639 in Digikam::ThumbnailLoadingTask::execute
(this=0x7ffdfc003e10) at
/usr/src/debug/digikam/digikam-8.8.0/core/libs/threadimageio/thumb/thumbnailtask.cpp:174
#21 0x00007ffff64e5d16 in Digikam::LoadSaveThread::run (this=0x7ffdfc001510) at
/usr/src/debug/digikam/digikam-8.8.0/core/libs/threadimageio/fileio/loadsavethread.cpp:118
#22 0x00007ffff652b18b in Digikam::DynamicThread::Private::run
(this=0x7ffdfc001420) at
/usr/src/debug/digikam/digikam-8.8.0/core/libs/threads/dynamicthread.cpp:176
#23 0x00007ffff4490855 in QThreadPoolThread::run (this=0x555575829ba0) at
/usr/src/debug/qt6-base/qtbase/src/corelib/thread/qthreadpool.cpp:72
#24 0x00007ffff4530ca9 in operator() (__closure=<optimized out>) at
/usr/src/debug/qt6-base/qtbase/src/corelib/thread/qthread_unix.cpp:437
#25 (anonymous
namespace)::terminate_on_exception<QThreadPrivate::start(void*)::<lambda()> >
(t=...) at
/usr/src/debug/qt6-base/qtbase/src/corelib/thread/qthread_unix.cpp:367
#26 QThreadPrivate::start (arg=0x555575829ba0) at
/usr/src/debug/qt6-base/qtbase/src/corelib/thread/qthread_unix.cpp:397
#27 0x00007ffff3a969cb in start_thread (arg=<optimized out>) at
pthread_create.c:448
#28 0x00007ffff3b1aa0c in __GI___clone3 () at
../sysdeps/unix/sysv/linux/x86_64/clone3.S:78

So the problem is that orgSize in ThumbnailCreator::loadImageDetail has zero
values.

(gdb) p orgSize
$14 = {wd = {<QtPrivate::QCheckedIntegers::CheckIntTypeHelper<int>> = {<No data
fields>}, m_i = 0}, ht =
{<QtPrivate::QCheckedIntegers::CheckIntTypeHelper<int>> = {<No data fields>},
m_i = 0}}
(gdb) p previews.originalSize()
$18 = {wd = {<QtPrivate::QCheckedIntegers::CheckIntTypeHelper<int>> = {<No data
fields>}, m_i = 0}, ht =
{<QtPrivate::QCheckedIntegers::CheckIntTypeHelper<int>> = {<No data fields>},
m_i = 0}}

This one is obtained through previews.originalSize() but never checked whether
it has non-zero values. Later on, mapFromOriginalSize is assuming non-zero
values. 

Looking at MetaEnginePreviews, it is using Exiv2. When I run Exiv2 0.28.7 on
the corresponding image, it says:

exiv2 image.jxl
File name       : image.jxl
File size       : 11060735 Bytes
MIME type       : image/jxl
Image size      : 0 x 0
Thumbnail       : image/jpeg, 20347 Bytes
Camera make     : Canon
Camera model    : Canon EOS R6
Image timestamp : 2025:10:16 13:21:10
File number     : 
Exposure time   : 1/400 s
Aperture        : F2.8
Exposure bias   : 0 EV
Flash           : No flash
Flash bias      : 
Focal length    : 50.0 mm
Subject distance: 
ISO speed       : 200
Exposure mode   : Manual
Metering mode   : Multi-segment
Macro mode      : 
Image quality   : 
White balance   : Auto
Copyright       : 
Exif comment    :

This shows an image size of 0. This is a jxl file that is created losslessly
from a jpg. When I convert it back, it is fine:

$ djxl image.jxl image.jpg
$ exiv2 image.jpg
File name       : image.jpg
File size       : 13232302 Bytes
MIME type       : image/jpeg
Image size      : 5472 x 3648
Thumbnail       : image/jpeg, 20347 Bytes
Camera make     : Canon
Camera model    : Canon EOS R6
Image timestamp : 2025:10:16 13:21:10
File number     : 
Exposure time   : 1/400 s
Aperture        : F2.8
Exposure bias   : 0 EV
Flash           : No flash
Flash bias      : 
Focal length    : 50.0 mm
Subject distance: 
ISO speed       : 200
Exposure mode   : Manual
Metering mode   : Multi-segment
Macro mode      : 
Image quality   : 
White balance   : Auto
Copyright       : 
Exif comment    : 

It now sees the size. So even though the underlying issue is in ExiV2, digiKam
shouldn't crash, right?

For reference, exiftool does show the correct size on the jxl image:

Image Width                     : 5472
Image Height                    : 3648

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to