Opened 2 years ago

Closed 2 years ago

#9706 closed defect (fixed)

FFMpeg 5.0 and audio join filter leads to Segmentation Fault.

Reported by: Bryce Chester Newman Owned by:
Priority: important Component: ffmpeg
Version: unspecified Keywords:
Cc: Bryce Chester Newman Blocked By:
Blocking: yes Reproduced by developer: no
Analyzed by developer: no

Description

Hello,
The following command used to work in FFMpeg 4.4, but in FFmpeg 5.0 causes a segmentation fault. If I remove the audio “join” filter the segmentation fault does not occur.
See attached file for debug output and gdb output are below. I encounter this segmentation fault on Ubuntu 20.04 as well.

./ffmpeg -v 9 -loglevel 99 -i /tmp/HD5_720_DVCPROHD_Horizontal_Progressive_NoAudio.mov \

-sws_flags bicubic -filter_complex "[0:v:0]scale='960x720'[video-out];[0:a]join=inputs=6,volumedetect[audio-out]" \
-map "[video-out]" -map "[audio-out]" -map_metadata -1 -f mp4 -vcodec libx264 -pix_fmt yuv420p -profile:v main -level 4.0 -map 0:a\? -b:v 5400K -movflags faststart -refs 4 -color_primaries bt709 -color_trc bt709 -colorspace bt709 -preset slower /tmp/hd.mp4


Attachments (1)

output.txt (548.3 KB ) - added by Bryce Chester Newman 2 years ago.
ffmpeg debug and gdb output

Download all attachments as: .zip

Change History (16)

by Bryce Chester Newman, 2 years ago

Attachment: output.txt added

ffmpeg debug and gdb output

comment:1 by Elon Musk, 2 years ago

Can you try with latest master version?

If can not, could you upload input file somewhere and link it here?

comment:3 by Elon Musk, 2 years ago

Does not happen on master version.

in reply to:  3 ; comment:4 by Bryce Chester Newman, 2 years ago

Replying to Elon Musk:

Does not happen on master version.

I just tried master on Ubuntu 20.04 and I can reproduce it.

in reply to:  4 comment:5 by Bryce Chester Newman, 2 years ago

Replying to Bryce Chester Newman:

Replying to Elon Musk:

Does not happen on master version.

I just tried master on Ubuntu 20.04 and I can reproduce it.

I compiled against master on Ubuntu 20.04 and also tried https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-amd64-static.tar.xz. Granted the latter is a little bit behind master but both still reproduce the fault.

I find this interesting though. I can not reproduce this issue on...

ffmpeg version 5.0 Copyright (c) 2000-2022 the FFmpeg developers

built with Apple clang version 13.0.0 (clang-1300.0.29.30)
configuration: --prefix=/usr/local/Cellar/ffmpeg/5.0 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox
libavutil 57. 17.100 / 57. 17.100
libavcodec 59. 18.100 / 59. 18.100
libavformat 59. 16.100 / 59. 16.100
libavdevice 59. 4.100 / 59. 4.100
libavfilter 8. 24.100 / 8. 24.100
libswscale 6. 4.100 / 6. 4.100
libswresample 4. 3.100 / 4. 3.100
libpostproc 56. 3.100 / 56. 3.100

comment:6 by Elon Musk, 2 years ago

Please compile with debug symbols not stripped, and post backtrace from gdb output.

in reply to:  6 comment:7 by Bryce Chester Newman, 2 years ago

Replying to Elon Musk:

Please compile with debug symbols not stripped, and post backtrace from gdb output.

Sure. np. Do you want the compile changes and gdb output from master or release/5.0 branch?

comment:8 by Elon Musk, 2 years ago

Master, build master and if it crashes, post gdb bt output.

in reply to:  8 comment:9 by Bryce Chester Newman, 2 years ago

Replying to Elon Musk:

Master, build master and if it crashes, post gdb bt output.

Here is the output from gdb.

Thread 1 "ffmpeg" received signal SIGSEGV, Segmentation fault.
0x00007f2d0e815a8a in ?? () from /usr/local/lib/libavfilter.so.8
(gdb) bt
#0 0x00007f2d0e815a8a in ?? () from /usr/local/lib/libavfilter.so.8
#1 0x00007f2d0e83c9e7 in ?? () from /usr/local/lib/libavfilter.so.8
#2 0x00007f2d0e8408f5 in av_buffersrc_add_frame_flags () from /usr/local/lib/libavfilter.so.8
#3 0x000055d428df6cf8 in ?? ()
#4 0x000055d428df82a5 in ?? ()
#5 0x000055d428dfa253 in ?? ()
#6 0x000055d428ddde89 in ?? ()
#7 0x00007f2d0d05f0b3 in libc_start_main (main=0x55d428dddd00, argc=40, argv=0x7fff41a27168, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fff41a27158)

at ../csu/libc-start.c:308

#8 0x000055d428dddfbe in ?? ()
(gdb) disass $pc-32,$pc+32
Dump of assembler code from 0x7f2d0e815a6a to 0x7f2d0e815aaa:

0x00007f2d0e815a6a: mov (%rax),%edi
0x00007f2d0e815a6c: callq 0x7f2d0e83cc4e
0x00007f2d0e815a71: jmpq 0x7f2d0e815b14
0x00007f2d0e815a76: mov 0x48(%r14),%rax
0x00007f2d0e815a7a: movl $0x1,(%rsp)
0x00007f2d0e815a81: mov $0x8,%r13d
0x00007f2d0e815a87: mov (%rax),%rax

=> 0x00007f2d0e815a8a: mov 0x70(%rax),%r15d

0x00007f2d0e815a8e: lea 0x18(%rsp),%rax
0x00007f2d0e815a93: mov %rax,0x8(%rsp)
0x00007f2d0e815a98: jmp 0x7f2d0e815aa1
0x00007f2d0e815a9a: incl (%rsp)
0x00007f2d0e815a9d: add $0x8,%r13
0x00007f2d0e815aa1: mov 0x28(%rbp),%edx
0x00007f2d0e815aa4: cmp (%rsp),%edx
0x00007f2d0e815aa7: jbe 0x7f2d0e815b3d

End of assembler dump.
(gdb) info all-registers
rax 0x0 0
rbx 0x0 0
rcx 0x15 21
rdx 0x15 21
rsi 0x7fff41a26644 140734294550084
rdi 0x55d42a976880 94369735993472
rbp 0x55d42a8ea700 0x55d42a8ea700
rsp 0x7fff41a26630 0x7fff41a26630
r8 0x15 21
r9 0x7fff41a25fa0 140734294548384
r10 0x7f2d0d40de1b 139831472610843
r11 0x7f2d0d40aaf6 139831472597750
r12 0x0 0
r13 0x8 8
r14 0x55d42a8ea840 94369735419968
r15 0x0 0
rip 0x7f2d0e815a8a 0x7f2d0e815a8a
eflags 0x10246 [ PF ZF IF RF ]
cs 0x33 51
ss 0x2b 43
ds 0x0 0
es 0x0 0
fs 0x0 0
gs 0x0 0
st0 -nan(0xffc6ffc6ffc6ffc6) (raw 0xffffffc6ffc6ffc6ffc6)
st1 <invalid float value> (raw 0xffff0038003800380038)
st2 -nan(0xfff1fff1fff1fff1) (raw 0xfffffff1fff1fff1fff1)
st3 -nan(0x8484848484858584) (raw 0xffff8484848484858584)
st4 <invalid float value> (raw 0xffff0084008400840084)
st5 -nan(0xfff1fff1fff1fff1) (raw 0xfffffff1fff1fff1fff1)
st6 0 (raw 0x00000000000000000000)
st7 <invalid float value> (raw 0xffff0007000700070007)
fctrl 0x37f 895
fstat 0x0 0
ftag 0xffff 65535
fiseg 0x0 0
fioff 0x0 0
foseg 0x0 0
fooff 0x0 0
fop 0x0 0
mxcsr 0x1fbe [ DE ZE OE UE PE IM DM ZM OM UM PM ]
ymm0 {v8_float = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_double = {0x0, 0x0, 0x0, 0x0}, v32_int8 = {0xe0, 0x7b, 0x22, 0xd, 0x2d, 0x7f, 0x0, 0x0, 0xe0, 0x7b, 0x22, 0xd, 0x2d, 0x7f, 0x0 <repeats 18 times>}, v16_int16 = {0x7be0, 0xd22, 0x7f2d, 0x0, 0x7be0, 0xd22, 0x7f2d, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v8_int32 = {0xd227be0, 0x7f2d, 0xd227be0, 0x7f2d, 0x0, 0x0, 0x0, 0x0}, v--Type <RET> for more, q to quit, c to continue without paging--c
4_int64 = {0x7f2d0d227be0, 0x7f2d0d227be0, 0x0, 0x0}, v2_int128 = {0x7f2d0d227be000007f2d0d227be0, 0x0}}
ymm1 {v8_float = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_double = {0x0, 0x0, 0x0, 0x0}, v32_int8 = {0xe0, 0x7b, 0x22, 0xd, 0x2d, 0x7f, 0x0 <repeats 26 times>}, v16_int16 = {0x7be0, 0xd22, 0x7f2d, 0x0 <repeats 13 times>}, v8_int32 = {0xd227be0, 0x7f2d, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int64 = {0x7f2d0d227be0, 0x0, 0x0, 0x0}, v2_int128 = {0x7f2d0d227be0, 0x0}}
ymm2 {v8_float = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_double = {0x0, 0x0, 0x0, 0x0}, v32_int8 = {0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0x0, 0x0, 0x0, 0x0, 0xff, 0x0 <repeats 18 times>}, v16_int16 = {0xff, 0x0, 0x0, 0x0, 0xff, 0x0, 0xff00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v8_int32 = {0xff, 0x0, 0xff, 0xff00, 0x0, 0x0, 0x0, 0x0}, v4_int64 = {0xff, 0xff00000000ff, 0x0, 0x0}, v2_int128 = {0xff00000000ff00000000000000ff, 0x0}}
ymm3 {v8_float = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_double = {0x0, 0x0, 0x0, 0x0}, v32_int8 = {0xd0, 0x7d, 0x22, 0xd, 0x2d, 0x7f, 0x0 <repeats 26 times>}, v16_int16 = {0x7dd0, 0xd22, 0x7f2d, 0x0 <repeats 13 times>}, v8_int32 = {0xd227dd0, 0x7f2d, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int64 = {0x7f2d0d227dd0, 0x0, 0x0, 0x0}, v2_int128 = {0x7f2d0d227dd0, 0x0}}
ymm4 {v8_float = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_double = {0x0, 0x0, 0x0, 0x0}, v32_int8 = {0xe0, 0x7b, 0x22, 0xd, 0x2d, 0x7f, 0x0 <repeats 26 times>}, v16_int16 = {0x7be0, 0xd22, 0x7f2d, 0x0 <repeats 13 times>}, v8_int32 = {0xd227be0, 0x7f2d, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int64 = {0x7f2d0d227be0, 0x0, 0x0, 0x0}, v2_int128 = {0x7f2d0d227be0, 0x0}}
ymm5 {v8_float = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_double = {0x0, 0x0, 0x0, 0x0}, v32_int8 = {0xe0, 0x7b, 0x22, 0xd, 0x2d, 0x7f, 0x0 <repeats 26 times>}, v16_int16 = {0x7be0, 0xd22, 0x7f2d, 0x0 <repeats 13 times>}, v8_int32 = {0xd227be0, 0x7f2d, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int64 = {0x7f2d0d227be0, 0x0, 0x0, 0x0}, v2_int128 = {0x7f2d0d227be0, 0x0}}
ymm6 {v8_float = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_double = {0x0, 0x0, 0x0, 0x0}, v32_int8 = {0x0, 0xee, 0x37, 0x2a, 0xd4, 0x55, 0x0, 0x0, 0x40, 0xfc, 0x37, 0x2a, 0xd4, 0x55, 0x0 <repeats 18 times>}, v16_int16 = {0xee00, 0x2a37, 0x55d4, 0x0, 0xfc40, 0x2a37, 0x55d4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v8_int32 = {0x2a37ee00, 0x55d4, 0x2a37fc40, 0x55d4, 0x0, 0x0, 0x0, 0x0}, v4_int64 = {0x55d42a37ee00, 0x55d42a37fc40, 0x0, 0x0}, v2_int128 = {0x55d42a37fc40000055d42a37ee00, 0x0}}
ymm7 {v8_float = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_double = {0x0, 0x0, 0x0, 0x0}, v32_int8 = {0x0, 0x2a, 0x38, 0x2a, 0xd4, 0x55, 0x0, 0x0, 0x40, 0x38, 0x38, 0x2a, 0xd4, 0x55, 0x0 <repeats 18 times>}, v16_int16 = {0x2a00, 0x2a38, 0x55d4, 0x0, 0x3840, 0x2a38, 0x55d4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v8_int32 = {0x2a382a00, 0x55d4, 0x2a383840, 0x55d4, 0x0, 0x0, 0x0, 0x0}, v4_int64 = {0x55d42a382a00, 0x55d42a383840, 0x0, 0x0}, v2_int128 = {0x55d42a383840000055d42a382a00, 0x0}}
ymm8 {v8_float = {0xffffffff, 0x0, 0xffffffff, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_double = {0x0, 0x0, 0x0, 0x0}, v32_int8 = {0x0, 0x20, 0x28, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x0, 0x20, 0x74, 0x6f, 0x20, 0x0, 0x20, 0x28, 0x0 <repeats 16 times>}, v16_int16 = {0x2000, 0x6628, 0x6f72, 0x206d, 0x2000, 0x6f74, 0x20, 0x2820, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v8_int32 = {0x66282000, 0x206d6f72, 0x6f742000, 0x28200020, 0x0, 0x0, 0x0, 0x0}, v4_int64 = {0x206d6f7266282000, 0x282000206f742000, 0x0, 0x0}, v2_int128 = {0x282000206f742000206d6f7266282000, 0x0}}
ymm9 {v8_float = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_double = {0x0, 0x0, 0x0, 0x0}, v32_int8 = {0x0 <repeats 32 times>}, v16_int16 = {0x0 <repeats 16 times>}, v8_int32 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int64 = {0x0, 0x0, 0x0, 0x0}, v2_int128 = {0x0, 0x0}}
ymm10 {v8_float = {0x56000000, 0xffffffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_double = {0x0, 0x0, 0x0, 0x0}, v32_int8 = {0x60, 0x55, 0x55, 0x55, 0x95, 0x55, 0xe5, 0xbf, 0x0 <repeats 24 times>}, v16_int16 = {0x5560, 0x5555, 0x5595, 0xbfe5, 0x0 <repeats 12 times>}, v8_int32 = {0x55555560, 0xbfe55595, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int64 = {0xbfe5559555555560, 0x0, 0x0, 0x0}, v2_int128 = {0xbfe5559555555560, 0x0}}
ymm11 {v8_float = {0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_double = {0x0, 0x0, 0x0, 0x0}, v32_int8 = {0xf5, 0xa9, 0xae, 0xee, 0xee, 0x99, 0xe9, 0x3f, 0x0 <repeats 24 times>}, v16_int16 = {0xa9f5, 0xeeae, 0x99ee, 0x3fe9, 0x0 <repeats 12 times>}, v8_int32 = {0xeeaea9f5, 0x3fe999ee, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int64 = {0x3fe999eeeeaea9f5, 0x0, 0x0, 0x0}, v2_int128 = {0x3fe999eeeeaea9f5, 0x0}}
ymm12 {v8_float = {0x0, 0xffffffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_double = {0xffffffffffffffff, 0x0, 0x0, 0x0}, v32_int8 = {0xe9, 0x45, 0x48, 0x9b, 0x5b, 0x49, 0xf2, 0xbf, 0x0 <repeats 24 times>}, v16_int16 = {0x45e9, 0x9b48, 0x495b, 0xbff2, 0x0 <repeats 12 times>}, v8_int32 = {0x9b4845e9, 0xbff2495b, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int64 = {0xbff2495b9b4845e9, 0x0, 0x0, 0x0}, v2_int128 = {0xbff2495b9b4845e9, 0x0}}
ymm13 {v8_float = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_double = {0x0, 0x0, 0x0, 0x0}, v32_int8 = {0x0 <repeats 32 times>}, v16_int16 = {0x0 <repeats 16 times>}, v8_int32 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int64 = {0x0, 0x0, 0x0, 0x0}, v2_int128 = {0x0, 0x0}}
ymm14 {v8_float = {0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_double = {0x0, 0x0, 0x0, 0x0}, v32_int8 = {0x92, 0xa7, 0xbb, 0xe9, 0xbb, 0xfd, 0x95, 0x3f, 0x0 <repeats 24 times>}, v16_int16 = {0xa792, 0xe9bb, 0xfdbb, 0x3f95, 0x0 <repeats 12 times>}, v8_int32 = {0xe9bba792, 0x3f95fdbb, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int64 = {0x3f95fdbbe9bba792, 0x0, 0x0, 0x0}, v2_int128 = {0x3f95fdbbe9bba792, 0x0}}
ymm15 {v8_float = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_double = {0x0, 0x0, 0x0, 0x0}, v32_int8 = {0x0, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x5, 0x0 <repeats 19 times>}, v16_int16 = {0x0, 0x0, 0x4, 0x0, 0x1, 0x0, 0x5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v8_int32 = {0x0, 0x4, 0x1, 0x5, 0x0, 0x0, 0x0, 0x0}, v4_int64 = {0x400000000, 0x500000001, 0x0, 0x0}, v2_int128 = {0x5000000010000000400000000, 0x0}}

comment:10 by Elon Musk, 2 years ago

But I said to not strip binary, because stripped gdb output is useless here.

in reply to:  10 comment:11 by Bryce Chester Newman, 2 years ago

Replying to Elon Musk:

But I said to not strip binary, because stripped gdb output is useless here.

Just to confirm...

Add --disable-stripping?

comment:12 by Elon Musk, 2 years ago

Yes

in reply to:  12 comment:13 by Bryce Chester Newman, 2 years ago

Replying to Elon Musk:

Yes

Thread 1 "ffmpeg" received signal SIGSEGV, Segmentation fault.
0x00007fb22047ea8a in activate (ctx=0x5592e53c7fc0) at libavfilter/af_join.c:589
589 libavfilter/af_join.c: No such file or directory.
(gdb) bt
#0 0x00007fb22047ea8a in activate (ctx=0x5592e53c7fc0) at libavfilter/af_join.c:589
#1 0x00007fb2204a59e7 in ff_filter_activate (filter=0x5592e53c7fc0) at libavfilter/avfilter.c:1363
#2 0x00007fb2204a8023 in ff_filter_graph_run_once (graph=graph@entry=0x5592e53c5940) at libavfilter/avfiltergraph.c:1351
#3 0x00007fb2204a98f5 in push_frame (graph=0x5592e53c5940) at libavfilter/buffersrc.c:169
#4 av_buffersrc_add_frame_flags (ctx=0x5592e544d100, frame=0x5592e47e1e80, flags=<optimized out>) at libavfilter/buffersrc.c:251
#5 0x00005592e464acf8 in ifilter_send_frame (keep_reference=<optimized out>, frame=0x5592e47e1e80, ifilter=0x5592e47e3200) at fftools/ffmpeg.c:2228
#6 send_frame_to_filters (ist=0x5592e47e15c0, decoded_frame=0x5592e47e1e80) at fftools/ffmpeg.c:2297
#7 0x00005592e464c2a5 in decode_audio (decode_failed=<synthetic pointer>, got_output=0x7ffd1dd2a6f4, pkt=0x5592e47e2080, ist=0x5592e47e15c0) at fftools/ffmpeg.c:2363
#8 process_input_packet (ist=0x5592e47e15c0, pkt=0x5592e479afc0, no_eof=0) at fftools/ffmpeg.c:2635
#9 0x00005592e464e253 in process_input (file_index=<optimized out>) at fftools/ffmpeg.c:4494
#10 transcode_step () at fftools/ffmpeg.c:4634
#11 transcode () at fftools/ffmpeg.c:4688
#12 0x00005592e4631e89 in main (argc=<optimized out>, argv=<optimized out>) at fftools/ffmpeg.c:4904

comment:14 by Elon Musk, 2 years ago

Ok, i pushed fix to master, try to do git pull and retest it.

comment:15 by Bryce Chester Newman, 2 years ago

Resolution: fixed
Status: newclosed

Compiles the latest master and I have confirmed this is fixed.
Nice work!
Thank you very much for working with me to resolution.

Note: See TracTickets for help on using tickets.