Created attachment 187923 [details] Digikam screen right before crashing by Confirming the detected face SUMMARY DigiKam 8.8.0 crashes during confirmation of a detected face from a HEIF/HEIC file. The crash occurs in the background thread FaceEditextract due to a Qt assertion failure in qRound(). STEPS TO REPRODUCE 1. Start DigiKam. 2. Let the scan process run & finish to detect new faces for the existing People items. 3. Find one person in People with "(<n> new)" items in it that are contains pictures in HEIF/HEIC format that need to be confirmed. 4. Confirm the detected face for one of those HEIF items (see attached screenshot). OBSERVED RESULT DigiKam crashes after being in the "DigiKam (Not Responding)" state for a few minutes. EXPECTED RESULT The selected picture is confirmed/added to the People person and DigiKam keeps working as usual. SOFTWARE/OS VERSIONS Operating System: Arch Linux KDE Plasma Version: 6.5.4 KDE Frameworks Version: 6.21.0 Qt Version: 6.10.1 Kernel Version: 6.18.1-arch1-2 (64-bit) Graphics Platform: Wayland ADDITIONAL INFORMATION The crash does not happen in the same system when confirming a detected face for a JPEG file.
Created attachment 187924 [details] gdb digikam backtrace I'm attaching the backtrace from gdb here.
Created attachment 187925 [details] HEIF file access permissions and ownership It might also be worth commenting that the digikam library is currently accessed from an NFS mount, so not sure if the crash might arise from the fact that the HEIF file has incorrect access permissions/ownership (see attached screenshot from Dolphin file manager of one of the HEIF files that crashes digikam).
It crashes in a `qRound()` function, but the values are coming from a facial region. We're likely dealing with an invalid float variable here. Gilles has identified a potential crash for digiKam-8.9.0. See the commit: https://invent.kde.org/graphics/digikam/-/commit/b6981387b54690ca379e22a8e5abec1da1c8ec95 I suspect this bug will be fixed in digiKam-8.9.0. Maik
Arnau, I also identified a crash with HEIF file on my computer, but not at the same place. The face region values from the database was the max possible which crash the program. As Maik said please try the the 8.9.0 pre-release AppImage to see if the dysfunction is reproducible. Files are there : https://files.kde.org/digikam/ Gilles Caulier
Created attachment 187931 [details] DigiKam 8.9.0 terminal output when the crash happens Hi Maik and Gilles, Thanks for the quick reply. I downloaded the 8.9.0 pre-release AppImage as Gilles suggested but the crash is still happening there - I'm attaching the terminal output where you can see the following error again: ASSERT: "!std::isnan(value)" in file ././/include/QtCore/qnumeric.h, line 501
Could you provide the HEIF image, if not publicly, then privately to my email? Maik
Maik, This is the analysis of Mistral AI on the relevant code from the backtrace. I think the recommendations are fine: // --------------------- Root Cause Analysis: The crash is triggered by a Qt assertion in qRound from qnumeric.h, specifically: ASSERT: "!std::isnan(value)" in file /usr/include/qt6/QtCore/qnumeric.h, line 501 Problem Breakdown: Direct Cause: The qRound function receives a NaN (Not a Number) value, which triggers a fatal assertion in Qt. This means one of the calculated values before the call to qRound is NaN. Source of NaN: The code calculates the following ratios: xThumbnailPercent and yThumbnailPercent: Ratios of the face region size to the image dimensions. xFaceAreaPercent and yFaceAreaPercent: Ratios of face coordinates (from faceEmbedding.first.at<float>(0, 2) and faceEmbedding.first.at<float>(0, 3)) to the thumbnail size. Critical Points: If package->info.dimensions().width() or package->info.dimensions().height() is zero, it causes a division by zero, resulting in NaN. If package->thumbnail.width() or package->thumbnail.height() is zero, the same issue occurs. If faceEmbedding.first.at<float>(0, 2) or faceEmbedding.first.at<float>(0, 3) is NaN or infinite, it can propagate NaN. Line 424: QSize faceSize(qRound(package->info.dimensions().width() * xThumbnailPercent * xFaceAreaPercent), qRound(package->info.dimensions().height() * yThumbnailPercent * yFaceAreaPercent)); If any of the calculated values (xThumbnailPercent, xFaceAreaPercent, etc.) is NaN, the call to qRound will fail. Proposed Solutions: 1. Check for Division by Zero Before calculating ratios, add checks to avoid division by zero: float width = static_cast<float>(package->info.dimensions().width()); float height = static_cast<float>(package->info.dimensions().height()); float thumbWidth = static_cast<float>(package->thumbnail.width()); float thumbHeight = static_cast<float>(package->thumbnail.height()); if (width <= 0 || height <= 0 || thumbWidth <= 0 || thumbHeight <= 0) { qWarning() << "Invalid dimensions or thumbnail size, skipping training check."; package->useForTraining = false; return; } 2. Check for NaN or Infinite Values Use std::isnan or std::isinf to detect invalid values in faceEmbedding: float xFacePos = faceEmbedding.first.at<float>(0, 2); float yFacePos = faceEmbedding.first.at<float>(0, 3); if (std::isnan(xFacePos) || std::isnan(yFacePos) || std::isinf(xFacePos) || std::isinf(yFacePos)) { qWarning() << "Invalid face embedding values, skipping training check."; package->useForTraining = false; return; } 3. Additional Debugging Log Values: Add logs to display the values of package->info.dimensions(), package->thumbnail, and faceEmbedding before calculations. This will help identify which value is invalid. Validate Input Data: Ensure the data passed to FacePipelineBase is valid (e.g., images and metadata are not corrupted). Summary of Recommended Actions: Add checks to prevent division by zero and NaN/inf values. Log values to pinpoint the source of the issue. Validate input data before using it in calculations. If the issue persists, check if the bug is reproducible with other images or if specific images consistently trigger the crash. This could indicate a problem with the generation of faceEmbedding data or image metadata. // --------------- Gilles
Git commit 6c1e8943e3069351aa6b479cd022907383641011 by Gilles Caulier. Committed on 24/12/2025 at 12:23. Pushed by cgilles into branch 'master'. face pipeline: checks from divide by zero, NaN, and infinite values. M +48 -24 core/utilities/facemanagement/pipelines/facepipelinebase.cpp https://invent.kde.org/graphics/digikam/-/commit/6c1e8943e3069351aa6b479cd022907383641011
Arnau, Code is patched. Please check with the next 8.9.0 pre-release AppImage if the crash is reproducible. It will be build in a few hours today. Best regards Gilles Caulier