<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>502889</bug_id>
          
          <creation_ts>2025-04-16 16:59:07 +0000</creation_ts>
          <short_desc>Digikam Crash and core dump of scanning for faces on a folder.</short_desc>
          <delta_ts>2025-04-19 12:32:59 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>2</classification_id>
          <classification>Applications</classification>
          <product>digikam</product>
          <component>Faces-Detection</component>
          <version>8.6.0</version>
          <rep_platform>openSUSE</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>NOR</priority>
          <bug_severity>crash</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Miguel Rozsas">miguel</reporter>
          <assigned_to name="Digikam Developers">digikam-bugs-null</assigned_to>
          <cc>metzpinguin</cc>
          
          <cf_commitlink>https://invent.kde.org/graphics/digikam/-/commit/a5bf90719fb092cba5bfc8e4a1a02f9ba7a82f0b</cf_commitlink>
          <cf_versionfixedin>8.7.0</cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>0</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2416391</commentid>
    <comment_count>0</comment_count>
    <who name="Miguel Rozsas">miguel</who>
    <bug_when>2025-04-16 16:59:07 +0000</bug_when>
    <thetext>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 &apos;LibRaw_exceptions&apos;
```
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</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2416426</commentid>
    <comment_count>1</comment_count>
    <who name="Maik Qualmann">metzpinguin</who>
    <bug_when>2025-04-16 18:12:13 +0000</bug_when>
    <thetext>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</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2416442</commentid>
    <comment_count>2</comment_count>
    <who name="Miguel Rozsas">miguel</who>
    <bug_when>2025-04-16 19:02:38 +0000</bug_when>
    <thetext>@Maik Qualmann

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

&gt; 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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2416475</commentid>
    <comment_count>3</comment_count>
    <who name="Miguel Rozsas">miguel</who>
    <bug_when>2025-04-16 20:11:08 +0000</bug_when>
    <thetext>I realize that I can not attach the RAF file because it exceeds the max file size.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2416588</commentid>
    <comment_count>4</comment_count>
    <who name="Maik Qualmann">metzpinguin</who>
    <bug_when>2025-04-17 06:04:45 +0000</bug_when>
    <thetext>Git commit a5bf90719fb092cba5bfc8e4a1a02f9ba7a82f0b by Maik Qualmann.
Committed on 17/04/2025 at 06:04.
Pushed by mqualmann into branch &apos;master&apos;.

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</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2416589</commentid>
    <comment_count>5</comment_count>
    <who name="Maik Qualmann">metzpinguin</who>
    <bug_when>2025-04-17 06:10:06 +0000</bug_when>
    <thetext>Thanks for the sample RAW image. Libraw clearly reports a corrupted RAW image, which digiKam also can&apos;t display, except for the embedded JPG preview image. It&apos;s hard to say what LR displays; it might just be the preview image. Whether the Libraw team can fix something or whether it&apos;s an unsupported format is something the Libraw team would have to clarify.

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

Maik</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2417127</commentid>
    <comment_count>6</comment_count>
    <who name="Miguel Rozsas">miguel</who>
    <bug_when>2025-04-19 12:08:48 +0000</bug_when>
    <thetext>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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2417135</commentid>
    <comment_count>7</comment_count>
    <who name="Maik Qualmann">metzpinguin</who>
    <bug_when>2025-04-19 12:32:59 +0000</bug_when>
    <thetext>It turns out that digiKam handles the exception from Libraw correctly and doesn&apos;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&apos;t want to load RAW images with the KImageFormats plugin.

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

Maik</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>