Bug 475554

Summary: Crash when importing a clip which was recorded in portrait mode
Product: [Applications] kdenlive Reporter: Jonas Schäfer <jonas>
Component: Rendering & ExportAssignee: Jean-Baptiste Mardelle <jb>
Status: RESOLVED FIXED    
Severity: crash CC: snd.noise
Priority: NOR    
Version First Reported In: 23.08.1   
Target Milestone: ---   
Platform: Flatpak   
OS: Linux   
Latest Commit: Version Fixed/Implemented In: 23.08.3
Sentry Crash Report:
Attachments: thread apply all bt full
video reproducing the crash

Description Jonas Schäfer 2023-10-13 07:52:36 UTC
Created attachment 162269 [details]
thread apply all bt full

SUMMARY
kdenlive crashes when importing a clip recorded in portrait format (i.e. height > width). That is the most concise I can describe it, because other clips from the same source import fine.


STEPS TO REPRODUCE
1. Start kdenlive with a blank project
2. Add the out.mkv clip

OBSERVED RESULT
kdenlive freezes briefly and then crashes.

EXPECTED RESULT
kdenlive imports the clip and shows a preview of it in the project bin.

SOFTWARE/OS VERSIONS
Using flatpak:
          ID: org.kde.kdenlive
         Ref: app/org.kde.kdenlive/x86_64/stable
        Arch: x86_64
      Branch: stable
     Version: 23.08.1
     License: GPL-3.0-only
      Origin: flathub
  Collection: org.flathub.Stable
Installation: system
   Installed: 262.5 MB
     Runtime: org.kde.Platform/x86_64/5.15-22.08
         Sdk: org.kde.Sdk/x86_64/5.15-22.08

      Commit: cccf66901d249eb2486e87636e3685579bd33830a2420d21d7b258f868ae7f51
      Parent: 322f25539b0d54540ce2bedb52ce6be7ed77aced7165d2734af55be7baca3285
     Subject: Update urllib3-2.0.5-py3-none-any.whl to 2.0.6 (fa9743d2)
        Date: 2023-10-02 20:36:20 +0000

ADDITIONAL INFORMATION
- clip plays fine with ffplay (ffplay version 6.0-7+b1 Copyright (c) 2003-2023 the FFmpeg developers) from debian/testing
- clip plays fine with melt (melt 7.18.0) from debian/testing
- the issue is also reproduced with 23.08.0 from debian/testing
Comment 1 Jonas Schäfer 2023-10-13 07:53:25 UTC
Created attachment 162270 [details]
video reproducing the crash
Comment 2 farid 2023-10-20 21:31:26 UTC
Confirmed on master as well:

Thread 26 "Thread (pooled)" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fff637fe6c0 (LWP 13093)]
__memcpy_avx_unaligned_erms ()
    at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:491
Downloading source file /usr/src/debug/glibc/glibc/string/../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S
491             VMOVA   %VMM(4), (VEC_SIZE * 3)(%rdi)                              
(gdb) bt
#0  __memcpy_avx_unaligned_erms ()
    at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:491
#1  0x00007fffcda3bee7 in resize_image
    (alpha_value=0 '\000', format=mlt_image_yuv420p10, bpp=<optimized out>, iheight=43, iwidth=1080, input=<optimized out>, oheight=1080, owidth=1920, output=<optimized out>) at /usr/src/debug/mlt-git/mlt/src/modules/core/filter_resize.c:119
#2  frame_resize_image
    (format=mlt_image_yuv420p10, oheight=1080, owidth=1920, frame=0x7fff5802e3c0)
    at /usr/src/debug/mlt-git/mlt/src/modules/core/filter_resize.c:164
#3  filter_get_image
    (frame=frame@entry=0x7fff5802e3c0, image=image@entry=0x7fff637fd9f0, format=format@entry=0x7fff637fda60, width=width@entry=0x7fff637fda64, height=height@entry=0x7fff637fda68, writable=writable@entry=0)
    at /usr/src/debug/mlt-git/mlt/src/modules/core/filter_resize.c:281
#4  0x00007ffff7cf3b42 in mlt_frame_get_image
    (self=0x7fff5802e3c0, buffer=0x7fff637fd9f0, format=0x7fff637fda60, width=0x7fff637fda64, height=0x7fff637fda68, writable=0)
    at /usr/src/debug/mlt-git/mlt/src/framework/mlt_frame.c:516
#5  0x00007ffff7cc6363 in Mlt::Frame::get_image(mlt_image_format&, int&, int&, int) (this=0x7fff5805dee0, format=@0x7fff637fda60: mlt_image_yuv420p10, w=@0x7fff637fda64: 1920, h=@0x7fff637fda68: 1080, writable=0)
    at /usr/src/debug/mlt-git/mlt/src/mlt++/MltFrame.cpp:81
#6  0x0000555555a94631 in ClipLoadTask::run() (this=0x555569bddbd0)
--Type <RET> for more, q to quit, c to continue without paging--c
    at /home/farid/kdenlive/src/jobs/cliploadtask.cpp:609
#7  0x00007ffff4cf8381 in  () at /usr/lib/libQt5Core.so.5
#8  0x00007ffff4cf35da in  () at /usr/lib/libQt5Core.so.5
#9  0x00007ffff46aa9eb in start_thread (arg=<optimized out>) at pthread_create.c:444
#10 0x00007ffff472e7cc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
(gdb)
Comment 3 Jean-Baptiste Mardelle 2023-10-21 08:11:40 UTC
Thanks for your report. This is an upstream issue, mlt crashes trying to open the file... I will investigate a bit more and report to MLT in the next days
Comment 4 Jonas Schäfer 2023-10-21 12:13:38 UTC
Thanks for the reply & taking care of upstreaming the report!
Comment 5 Jean-Baptiste Mardelle 2023-10-25 07:08:57 UTC
Git commit 4d6f30d75356d4574151c82e2383ab836f73ecab by Jean-Baptiste Mardelle.
Committed on 25/10/2023 at 09:08.
Pushed by mardelle into branch 'master'.

Clip loading: switch to Mlt::Producer probe() instead of fetching frame.
FIXED-IN: 23.08.3

M  +3    -8    src/jobs/cliploadtask.cpp

https://invent.kde.org/multimedia/kdenlive/-/commit/4d6f30d75356d4574151c82e2383ab836f73ecab
Comment 6 Jean-Baptiste Mardelle 2023-11-01 08:00:10 UTC
Git commit 707f139f5d869ec659045c0d534f90a762d4021c by Jean-Baptiste Mardelle.
Committed on 01/11/2023 at 08:55.
Pushed by mardelle into branch 'release/23.08'.

Clip loading: switch to Mlt::Producer probe() instead of fetching frame.
FIXED-IN: 23.08.3

M  +3    -8    src/jobs/cliploadtask.cpp

https://invent.kde.org/multimedia/kdenlive/-/commit/707f139f5d869ec659045c0d534f90a762d4021c