Bug 471269 - Application crashes when album contains avif file
Summary: Application crashes when album contains avif file
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Thumbs-Video (other bugs)
Version First Reported In: 8.0.0
Platform: Microsoft Windows Microsoft Windows
: NOR crash
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-06-20 19:35 UTC by SA
Modified: 2023-10-20 22:42 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In: 8.2.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description SA 2023-06-20 19:35:02 UTC
SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***


STEPS TO REPRODUCE
1. Add .avif file to the target album
2. Run "Scan for New Items" - digiKam crashes
3. Restart digiKam and select the target album - digiKam crashes

OBSERVED RESULT
digiKam crashes when it encounters a .avif file in the album. Relaunch works if it can start with some other album.

EXPECTED RESULT
Either it doesn't include .avif as an image file to show in the album, or throws a warning when scanning for new items.

SOFTWARE/OS VERSIONS
Windows: 11 Home
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
digiKam updated to latest version. I guess if the application is set to auto-scan on startup, then it will keep crashing on launch (I don't want to try it). I am on Windows, so cannot generate backtrace.
Comment 1 Maik Qualmann 2023-06-21 06:17:45 UTC
Can you please test and report whether the problem can still be reproduced with the upcoming digiKam-8.1.0 release.

digiKam-8.1.0 download: https://files.kde.org/digikam/

Maik
Comment 2 SA 2023-06-22 06:20:09 UTC
(In reply to Maik Qualmann from comment #1)
> Can you please test and report whether the problem can still be reproduced
> with the upcoming digiKam-8.1.0 release.
> 
> digiKam-8.1.0 download: https://files.kde.org/digikam/
> 
> Maik

Sure, will do as soon as I get it. Thank you for looking into it.
Comment 3 Maik Qualmann 2023-07-01 20:48:12 UTC
*** Bug 471797 has been marked as a duplicate of this bug. ***
Comment 4 Maik Qualmann 2023-07-23 05:48:13 UTC
Git commit ab3e2e5adb8d9e51cda6973e57828569dff21141 by Maik Qualmann.
Committed on 23/07/2023 at 07:46.
Pushed by mqualmann into branch 'master'.

try new settings to compile libaom
Related: bug 471797, bug 472508

M  +2    -1    project/bundles/3rdparty/ext_libaom/CMakeLists.txt

https://invent.kde.org/graphics/digikam/-/commit/ab3e2e5adb8d9e51cda6973e57828569dff21141
Comment 5 SA 2023-08-02 19:26:28 UTC
(In reply to Maik Qualmann from comment #1)
> Can you please test and report whether the problem can still be reproduced
> with the upcoming digiKam-8.1.0 release.
> 
> digiKam-8.1.0 download: https://files.kde.org/digikam/
> 
> Maik

Hello Maik
I have just tested 8.1.0 release, and the bug still remains.
digiKam crashes with .avif files in the source folder when scanning for new items.
No crash when all .avif files are removed.
Comment 6 Maik Qualmann 2023-08-02 19:45:06 UTC
The latest changes are only in digiKam-8.2.0, please try this version from here:

https://files.kde.org/digikam/

Maik
Comment 7 philip_ramone 2023-08-02 20:06:08 UTC
If it's of any help, the .AVIF file which I had attached to bug report 471797 still crashes DigiKam, even when using the latest (8.2.0) version.
Comment 8 caulier.gilles 2023-10-15 03:27:31 UTC
@SA,

This problem still reproducible with the new digiKam 8.2.0 pre-release Windows
installer available at usual place:

https://files.kde.org/digikam/

This new bundle is based on last Qt framework 5.15.11 and KDE framework 5.110.

Thanks in advance

Gilles Caulier
Comment 9 philip_ramone 2023-10-15 13:58:01 UTC
In case it helps, I can also confirm that the file attached to bug report 471797 is still causing the same issues in digiKam-8.2.0-20231014T165117-Win64.exe.
Comment 10 caulier.gilles 2023-10-17 08:22:36 UTC
Strange.

The patch from Maik is now applied the the last Windows build and libaom have been also updated.

Maik, perhaps it miss some optional dependencies to libaom ?

https://invent.kde.org/graphics/digikam/-/blob/master/project/bundles/3rdparty/ext_libaom/CMakeLists.txt?ref_type=heads

List of build options from aommedia from git/master:

ENABLE_ARM_CRC32:BOOL=ON
ENABLE_AVX:BOOL=ON
ENABLE_AVX2:BOOL=ON
ENABLE_CCACHE:BOOL=OFF
ENABLE_DECODE_PERF_TESTS:BOOL=OFF
ENABLE_DISTCC:BOOL=OFF
ENABLE_DOCS:BOOL=ON
ENABLE_ENCODE_PERF_TESTS:BOOL=OFF
ENABLE_EXAMPLES:BOOL=ON
ENABLE_GOMA:BOOL=OFF
ENABLE_IDE_TEST_HOSTING:BOOL=OFF
ENABLE_MMX:BOOL=ON
ENABLE_NASM:BOOL=OFF
ENABLE_NEON:BOOL=ON
ENABLE_NEON_DOTPROD:BOOL=ON
ENABLE_NEON_I8MM:BOOL=ON
ENABLE_SSE:BOOL=ON
ENABLE_SSE2:BOOL=ON
ENABLE_SSE3:BOOL=ON
ENABLE_SSE4_1:BOOL=ON
ENABLE_SSE4_2:BOOL=ON
ENABLE_SSSE3:BOOL=ON
ENABLE_SVE:BOOL=ON
ENABLE_TESTDATA:BOOL=ON
ENABLE_TESTS:BOOL=ON
ENABLE_TOOLS:BOOL=ON
ENABLE_VSX:BOOL=ON
ENABLE_WERROR:BOOL=OFF

Gilles
Comment 11 Maik Qualmann 2023-10-17 08:35:38 UTC
The main problem is that I cannot reproduce the crash on 3 different Windows (AMD/Intel) computers. The library does not use GPU acceleration. So it can only be due to some SSE options.

Maik
Comment 12 caulier.gilles 2023-10-18 09:45:49 UTC
Git commit facf389c1f941ef19fb93fe5ac0ba9f276a193b1 by Gilles Caulier.
Committed on 18/10/2023 at 11:43.
Pushed by cgilles into branch 'master'.

MXE libaom build for Windows : disabme SSE +MMX optimizations

M  +7    -0    project/bundles/3rdparty/ext_libaom/CMakeLists.txt

https://invent.kde.org/graphics/digikam/-/commit/facf389c1f941ef19fb93fe5ac0ba9f276a193b1
Comment 13 dnovomesky 2023-10-19 15:14:53 UTC
My crash using digiKam-8.2.0-20231017T044001-Win64-debug.exe in libaom!aom_codec_av1_cx is because vmovdqa instruction.

That instruction probably requires aligned data and I saw that lot of people using Mingw compiler complained that generated code crashes.

(gdb) bt
#0  0x00007ffc7ccd726e in libaom!aom_codec_av1_cx () from C:\Program Files\digiKam\libaom.dll
#1  0x00007ffc7ccdbbbd in libaom!aom_codec_av1_cx () from C:\Program Files\digiKam\libaom.dll
#2  0x00007ffc7cac9bd1 in libaom!aom_free () from C:\Program Files\digiKam\libaom.dll
#3  0x00007ffc7cac8350 in libaom!aom_free () from C:\Program Files\digiKam\libaom.dll
#4  0x00007ffc7caeb907 in libaom!av1_resize_frame420 () from C:\Program Files\digiKam\libaom.dll
#5  0x00007ffc7caae738 in libaom!aom_free () from C:\Program Files\digiKam\libaom.dll
#6  0x00007ffcd0ba4d33 in pthread_create_wrapper () from C:\Program Files\digiKam\libwinpthread-1.dll
#7  0x00007ffcdd0eaf5a in msvcrt!_beginthreadex () from C:\WINDOWS\System32\msvcrt.dll
#8  0x00007ffcdd0eb02c in msvcrt!_endthreadex () from C:\WINDOWS\System32\msvcrt.dll
#9  0x00007ffcde537344 in KERNEL32!BaseThreadInitThunk () from C:\WINDOWS\System32\kernel32.dll
#10 0x00007ffcde8a26b1 in ntdll!RtlUserThreadStart () from C:\WINDOWS\SYSTEM32\ntdll.dll
#11 0x0000000000000000 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

> 0x7ffc7ccd726e <libaom!aom_codec_av1_cx+1803422>        vmovdqa %ymm0,(%rcx)
  0x7ffc7ccd7272 <libaom!aom_codec_av1_cx+1803426>        vmovdqu %xmm1,(%r9)
  0x7ffc7ccd7277 <libaom!aom_codec_av1_cx+1803431>        vzeroupper
  0x7ffc7ccd727a <libaom!aom_codec_av1_cx+1803434>        vmovaps 0x260(%rsp),%xmm6
  0x7ffc7ccd7283 <libaom!aom_codec_av1_cx+1803443>        vmovaps 0x270(%rsp),%xmm7
  0x7ffc7ccd728c <libaom!aom_codec_av1_cx+1803452>        vmovaps 0x280(%rsp),%xmm8
  0x7ffc7ccd7295 <libaom!aom_codec_av1_cx+1803461>        vmovaps 0x290(%rsp),%xmm9
  0x7ffc7ccd729e <libaom!aom_codec_av1_cx+1803470>        vmovaps 0x2a0(%rsp),%xmm10
  0x7ffc7ccd72a7 <libaom!aom_codec_av1_cx+1803479>        vmovaps 0x2b0(%rsp),%xmm11
  0x7ffc7ccd72b0 <libaom!aom_codec_av1_cx+1803488>        vmovaps 0x2c0(%rsp),%xmm12
  0x7ffc7ccd72b9 <libaom!aom_codec_av1_cx+1803497>        vmovaps 0x2d0(%rsp),%xmm13
  0x7ffc7ccd72c2 <libaom!aom_codec_av1_cx+1803506>        vmovaps 0x2e0(%rsp),%xmm14
  0x7ffc7ccd72cb <libaom!aom_codec_av1_cx+1803515>        vmovaps 0x2f0(%rsp),%xmm15
  0x7ffc7ccd72d4 <libaom!aom_codec_av1_cx+1803524>        add    $0x308,%rsp
  0x7ffc7ccd72db <libaom!aom_codec_av1_cx+1803531>        ret
Comment 14 caulier.gilles 2023-10-19 18:50:12 UTC
Hi,

The new digiKam 8.2.0 pre-release with the last fixes to test :

https://files.kde.org/digikam/

Best

Gilles Caulier
Comment 15 philip_ramone 2023-10-19 20:05:18 UTC
I'm happy to report that bug report 471797 appears to be resolved in digiKam-8.2.0-20231019T170231-Win64.exe.
Comment 16 Maik Qualmann 2023-10-19 20:34:01 UTC
We should try to reactivate some SSE optimizations so as not to cause a significant drop in performance.

Maik
Comment 17 caulier.gilles 2023-10-20 07:40:31 UTC
Hi Maik,

I think the MMX and SSE option are safe to enable. For other one, i don't know... We need runtime tests.

    set(AOM_Conf ${AOM_Conf}
               -DAOM_TARGET_CPU=x86_64
               -DAOM_TARGET_SYSTEM=Windows
               -DENABLE_MMX=OFF
               -DENABLE_SSE=OFF
               -DENABLE_SSE2=OFF
               -DENABLE_SSE3=OFF
               -DENABLE_SSE4_1=OFF
               -DENABLE_SSE4_2=OFF
               -DENABLE_SSSE3=OFF
    )

Gilles
Comment 18 caulier.gilles 2023-10-20 14:47:11 UTC
Git commit 2238609f510f2cc673ca189439347d15e413a4ca by Gilles Caulier.
Committed on 20/10/2023 at 16:43.
Pushed by cgilles into branch 'master'.

libaom under Windows : enable SSE and MMX only

M  +2    -2    project/bundles/3rdparty/ext_libaom/CMakeLists.txt

https://invent.kde.org/graphics/digikam/-/commit/2238609f510f2cc673ca189439347d15e413a4ca
Comment 19 caulier.gilles 2023-10-20 19:03:14 UTC
philip,

Can you test the last build from this evening to see if it crash ? I enabled 2 options in libaom : MMX and SSE support

Thanks in advance

Gilles Caulier
Comment 20 philip_ramone 2023-10-20 22:42:05 UTC
Hi Giles

I've just tried with the latest (digiKam-8.2.0-20231020T145742-Win64) version and I'm happy to report that the .AVIF file which was previously causing problems displays correctly (and does not cause DigiKam to crash on startup).

(Very many thanks for all your hard work identifying and resolving this issue. It's very much appreciated).