Bug 502889 - Digikam Crash and core dump of scanning for faces on a folder.
Summary: Digikam Crash and core dump of scanning for faces on a folder.
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Faces-Detection (other bugs)
Version First Reported In: 8.6.0
Platform: openSUSE Linux
: NOR crash
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-04-16 16:59 UTC by Miguel Rozsas
Modified: 2025-04-19 12:32 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Miguel Rozsas 2025-04-16 16:59:07 UTC
SUMMARY
Digikam crash/core-dump on Face detection with the message:
```
/run/media/miguel/RAW/miguel/RAW/2016/12/13/_DSF2806.RAF: data corrupted at 25233968
terminate called after throwing an instance of 'LibRaw_exceptions'
```
The file indeed it is  corrupted.
The current photo above (/_DSF2806.RAF) it is not corrupted. I can edit it on LR.
However, regardless it is corrupted or not, a corrupted file should not crash digikam.

STEPS TO REPRODUCE
1.  put a corrupted file on a folder
2.  scan for faces on that folder
3.  -

OBSERVED RESULT
crash and core dump

EXPECTED RESULT
Corrupted photos should be ignored without crashing digikam.

SOFTWARE/OS VERSIONS
perating System: openSUSE Tumbleweed 20250414
KDE Plasma Version: 6.3.4
KDE Frameworks Version: 6.12.0
Qt Version: 6.9.0
Kernel Version: 6.14.1-1-default (64-bit)
Graphics Platform: Wayland
Processors: 12 × AMD Ryzen 5 7600X 6-Core Processor
Memory: 30.6 GiB of RAM
Graphics Processor: AMD Radeon RX 6600

ADDITIONAL INFORMATION
file /run/media/miguel/RAW/miguel/RAW/2016/12/13/_DSF2806.RAF
/run/media/miguel/RAW/miguel/RAW/2016/12/13/_DSF2806.RAF: Fujifilm RAF raw image data, format version 0201, camera X-T2
Comment 1 Maik Qualmann 2025-04-16 18:12:13 UTC
If it crashes in Libraw, the bug should be reported to the Libraw team, not here.

Can you please make the RAW file available, if not publicly, via my private email.

Maik
Comment 2 Miguel Rozsas 2025-04-16 19:02:38 UTC
@Maik Qualmann

> If it crashes in Libraw, the bug should be reported to the Libraw team, not here.
ok, I will do.

> Can you please make the RAW file available, if not publicly, via my private email.
I did the file available as an attachment in the original bug report., unless you really want it privately.
Comment 3 Miguel Rozsas 2025-04-16 20:11:08 UTC
I realize that I can not attach the RAF file because it exceeds the max file size.
Comment 4 Maik Qualmann 2025-04-17 06:04:45 UTC
Git commit a5bf90719fb092cba5bfc8e4a1a02f9ba7a82f0b by Maik Qualmann.
Committed on 17/04/2025 at 06:04.
Pushed by mqualmann into branch 'master'.

do not load corrupt RAW images via magic byte detection with the QImage Loader
FIXED-IN: 8.7.0

M  +1    -1    NEWS
M  +5    -0    core/dplugins/dimg/qimage/dimgqimageplugin.cpp

https://invent.kde.org/graphics/digikam/-/commit/a5bf90719fb092cba5bfc8e4a1a02f9ba7a82f0b
Comment 5 Maik Qualmann 2025-04-17 06:10:06 UTC
Thanks for the sample RAW image. Libraw clearly reports a corrupted RAW image, which digiKam also can't display, except for the embedded JPG preview image. It's hard to say what LR displays; it might just be the preview image. Whether the Libraw team can fix something or whether it's an unsupported format is something the Libraw team would have to clarify.

I think I read in the Libraw forum that they don't want to load corrupted RAW images for various reasons.

Maik
Comment 6 Miguel Rozsas 2025-04-19 12:08:48 UTC
I understand that a corrupted image is not good for any kind of further processing and it should be ignored, but libraw just can not crash and core dump itself and any application that uses libraw code, like digikam.

instead , this situation should be identified and a proper exit and return value should indicate upstream that an abnormal situation was occurred , so it could recovery from it , gracefully.
Comment 7 Maik Qualmann 2025-04-19 12:32:59 UTC
It turns out that digiKam handles the exception from Libraw correctly and doesn't crash. However, the image was then passed to the universal QImage loader (KImageFormats plugin). KImageFormats also has a RAW image loader, and this then crashed.

You would then have to report the problem with the example image to KImageFormats. For example, Gwenview crashes with the image because it uses the KImageFormats plugin to load RAW images.

However, at digiKam, we generally don't want to load RAW images with the KImageFormats plugin.

I saw your bug report on Libraw: https://www.libraw.org/node/2846

Maik