[FFmpeg-trac] #3380(swresample:new): swresample segfault with 10-channel amerge+pan

FFmpeg trac at avcodec.org
Mon Feb 10 22:53:01 CET 2014


#3380: swresample segfault with 10-channel amerge+pan
------------------------------------+--------------------------------------
             Reporter:  MarkZV      |                     Type:  defect
               Status:  new         |                 Priority:  normal
            Component:  swresample  |                  Version:  git-master
             Keywords:              |               Blocked By:
             Blocking:              |  Reproduced by developer:  0
Analyzed by developer:  0           |
------------------------------------+--------------------------------------
 A segmentation fault is encountered attempting to do some mixing between
 five stereo inputs using the amerge and pan filters.  It should complete
 successfully without crashing.

 The crash can be reproduced with the following command, using a stereo
 input file such as fate-suite/audio-reference/luckynight_2ch_44kHz_s16.wav
 (the same file can be used for all inputs):
 {{{
 $ ffmpeg -v 9 -loglevel 99 -i in.wav -i in.wav -i in.wav -i in.wav -i
 in.wav -filter_complex '[0:a] [1:a] [2:a] [3:a] [4:a]
 amerge=inputs=5,pan=stereo|FL=0.5*c0+0.2*c2+0.1*c4+0.1*c6+0.1*c8|FR=0.5*c1+0.2*c3+0.1*c5+0.1*c7+0.1*c9
 [ac]' -map '[ac]' -t 5 -y out.ac3
 ffmpeg version N-60525-gdfc99ca Copyright (c) 2000-2014 the FFmpeg
 developers
   built on Feb 10 2014 12:55:53 with gcc 4.8.2 (MacPots gcc48 4.8.2_0)
   configuration: --enable-debug --assert-level=2 --prefix=/opt/local
 --enable-swscale --enable-avfilter --enable-avresample --enable-libmp3lame
 --enable-libvorbis --enable-libopus --enable-libtheora --enable-
 libschroedinger --enable-libopenjpeg --enable-libmodplug --enable-libvpx
 --enable-libspeex --enable-libass --enable-libbluray --enable-gnutls
 --enable-fontconfig --enable-libfreetype --mandir=/opt/local/share/man
 --enable-pthreads --cc=/opt/local/bin/gcc-mp-4.8 --arch=x86_64 --enable-
 yasm --enable-gpl --enable-postproc --enable-libx264 --enable-libxvid
 --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb
 --enable-nonfree --enable-libfdk-aac --enable-libfaac
   libavutil      52. 63.101 / 52. 63.101
   libavcodec     55. 50.100 / 55. 50.100
   libavformat    55. 31.100 / 55. 31.100
   libavdevice    55.  8.100 / 55.  8.100
   libavfilter     4.  1.102 /  4.  1.102
   libavresample   1.  1.  0 /  1.  1.  0
   libswscale      2.  5.101 /  2.  5.101
   libswresample   0. 17.104 /  0. 17.104
   libpostproc    52.  3.100 / 52.  3.100
 Splitting the commandline.
 Reading option '-v' ... matched as option 'v' (set logging level) with
 argument '9'.
 Reading option '-loglevel' ... matched as option 'loglevel' (set logging
 level) with argument '99'.
 Reading option '-i' ... matched as input file with argument 'in.wav'.
 Reading option '-i' ... matched as input file with argument 'in.wav'.
 Reading option '-i' ... matched as input file with argument 'in.wav'.
 Reading option '-i' ... matched as input file with argument 'in.wav'.
 Reading option '-i' ... matched as input file with argument 'in.wav'.
 Reading option '-filter_complex' ... matched as option 'filter_complex'
 (create a complex filtergraph) with argument '[0:a] [1:a] [2:a] [3:a]
 [4:a]
 amerge=inputs=5,pan=stereo|FL=0.5*c0+0.2*c2+0.1*c4+0.1*c6+0.1*c8|FR=0.5*c1+0.2*c3+0.1*c5+0.1*c7+0.1*c9
 [ac]'.
 Reading option '-map' ... matched as option 'map' (set input stream
 mapping) with argument '[ac]'.
 Reading option '-t' ... matched as option 't' (record or transcode
 "duration" seconds of audio/video) with argument '5'.
 Reading option '-y' ... matched as option 'y' (overwrite output files)
 with argument '1'.
 Reading option 'out.ac3' ... matched as output file.
 Finished splitting the commandline.
 Parsing a group of options: global .
 Applying option v (set logging level) with argument 9.
 Applying option filter_complex (create a complex filtergraph) with
 argument [0:a] [1:a] [2:a] [3:a] [4:a]
 amerge=inputs=5,pan=stereo|FL=0.5*c0+0.2*c2+0.1*c4+0.1*c6+0.1*c8|FR=0.5*c1+0.2*c3+0.1*c5+0.1*c7+0.1*c9
 [ac].
 Applying option y (overwrite output files) with argument 1.
 Successfully parsed a group of options.
 Parsing a group of options: input file in.wav.
 Successfully parsed a group of options.
 Opening an input file: in.wav.
 [wav @ 0x103065600] Format wav probed with size=2048 and score=99
 [wav @ 0x103065600] Before avformat_find_stream_info() pos: 46 bytes
 read:32768 seeks:0
 [wav @ 0x103065600] parser not found for codec pcm_s16le, packets or times
 may be invalid.
 [wav @ 0x103065600] probing stream 0 pp:4
 [wav @ 0x103065600] probing stream 0 pp:3
 [wav @ 0x103065600] probing stream 0 pp:2
 [wav @ 0x103065600] probing stream 0 pp:1
 [wav @ 0x103065600] probed stream 0
 [wav @ 0x103065600] parser not found for codec pcm_s16le, packets or times
 may be invalid.
 [wav @ 0x103065600] max_analyze_duration 5000000 reached at 5015510
 microseconds
 [wav @ 0x103065600] After avformat_find_stream_info() pos: 897070 bytes
 read:917504 seeks:0 frames:218
 Guessed Channel Layout for  Input Stream #0.0 : stereo
 Input #0, wav, from 'in.wav':
   Duration: 00:00:09.50, bitrate: 1411 kb/s
     Stream #0:0, 218, 1/44100: Audio: pcm_s16le ([1][0][0][0] / 0x0001),
 44100 Hz, stereo, s16, 1411 kb/s
 Successfully opened the file.
 Parsing a group of options: input file in.wav.
 Successfully parsed a group of options.
 Opening an input file: in.wav.
 [wav @ 0x103084e00] Format wav probed with size=2048 and score=99
 [wav @ 0x103084e00] Before avformat_find_stream_info() pos: 46 bytes
 read:32768 seeks:0
 [wav @ 0x103084e00] parser not found for codec pcm_s16le, packets or times
 may be invalid.
 [wav @ 0x103084e00] probing stream 0 pp:4
 [wav @ 0x103084e00] probing stream 0 pp:3
 [wav @ 0x103084e00] probing stream 0 pp:2
 [wav @ 0x103084e00] probing stream 0 pp:1
 [wav @ 0x103084e00] probed stream 0
 [wav @ 0x103084e00] parser not found for codec pcm_s16le, packets or times
 may be invalid.
 [wav @ 0x103084e00] max_analyze_duration 5000000 reached at 5015510
 microseconds
 [wav @ 0x103084e00] After avformat_find_stream_info() pos: 897070 bytes
 read:917504 seeks:0 frames:218
 Guessed Channel Layout for  Input Stream #1.0 : stereo
 Input #1, wav, from 'in.wav':
   Duration: 00:00:09.50, bitrate: 1411 kb/s
     Stream #1:0, 218, 1/44100: Audio: pcm_s16le ([1][0][0][0] / 0x0001),
 44100 Hz, stereo, s16, 1411 kb/s
 Successfully opened the file.
 Parsing a group of options: input file in.wav.
 Successfully parsed a group of options.
 Opening an input file: in.wav.
 [wav @ 0x10318c800] Format wav probed with size=2048 and score=99
 [wav @ 0x10318c800] Before avformat_find_stream_info() pos: 46 bytes
 read:32768 seeks:0
 [wav @ 0x10318c800] parser not found for codec pcm_s16le, packets or times
 may be invalid.
 [wav @ 0x10318c800] probing stream 0 pp:4
 [wav @ 0x10318c800] probing stream 0 pp:3
 [wav @ 0x10318c800] probing stream 0 pp:2
 [wav @ 0x10318c800] probing stream 0 pp:1
 [wav @ 0x10318c800] probed stream 0
 [wav @ 0x10318c800] parser not found for codec pcm_s16le, packets or times
 may be invalid.
 [wav @ 0x10318c800] max_analyze_duration 5000000 reached at 5015510
 microseconds
 [wav @ 0x10318c800] After avformat_find_stream_info() pos: 897070 bytes
 read:917504 seeks:0 frames:218
 Guessed Channel Layout for  Input Stream #2.0 : stereo
 Input #2, wav, from 'in.wav':
   Duration: 00:00:09.50, bitrate: 1411 kb/s
     Stream #2:0, 218, 1/44100: Audio: pcm_s16le ([1][0][0][0] / 0x0001),
 44100 Hz, stereo, s16, 1411 kb/s
 Successfully opened the file.
 Parsing a group of options: input file in.wav.
 Successfully parsed a group of options.
 Opening an input file: in.wav.
 [wav @ 0x10306bc00] Format wav probed with size=2048 and score=99
 [wav @ 0x10306bc00] Before avformat_find_stream_info() pos: 46 bytes
 read:32768 seeks:0
 [wav @ 0x10306bc00] parser not found for codec pcm_s16le, packets or times
 may be invalid.
 [wav @ 0x10306bc00] probing stream 0 pp:4
 [wav @ 0x10306bc00] probing stream 0 pp:3
 [wav @ 0x10306bc00] probing stream 0 pp:2
 [wav @ 0x10306bc00] probing stream 0 pp:1
 [wav @ 0x10306bc00] probed stream 0
 [wav @ 0x10306bc00] parser not found for codec pcm_s16le, packets or times
 may be invalid.
 [wav @ 0x10306bc00] max_analyze_duration 5000000 reached at 5015510
 microseconds
 [wav @ 0x10306bc00] After avformat_find_stream_info() pos: 897070 bytes
 read:917504 seeks:0 frames:218
 Guessed Channel Layout for  Input Stream #3.0 : stereo
 Input #3, wav, from 'in.wav':
   Duration: 00:00:09.50, bitrate: 1411 kb/s
     Stream #3:0, 218, 1/44100: Audio: pcm_s16le ([1][0][0][0] / 0x0001),
 44100 Hz, stereo, s16, 1411 kb/s
 Successfully opened the file.
 Parsing a group of options: input file in.wav.
 Successfully parsed a group of options.
 Opening an input file: in.wav.
 [wav @ 0x10338f000] Format wav probed with size=2048 and score=99
 [wav @ 0x10338f000] Before avformat_find_stream_info() pos: 46 bytes
 read:32768 seeks:0
 [wav @ 0x10338f000] parser not found for codec pcm_s16le, packets or times
 may be invalid.
 [wav @ 0x10338f000] probing stream 0 pp:4
 [wav @ 0x10338f000] probing stream 0 pp:3
 [wav @ 0x10338f000] probing stream 0 pp:2
 [wav @ 0x10338f000] probing stream 0 pp:1
 [wav @ 0x10338f000] probed stream 0
 [wav @ 0x10338f000] parser not found for codec pcm_s16le, packets or times
 may be invalid.
 [wav @ 0x10338f000] max_analyze_duration 5000000 reached at 5015510
 microseconds
 [wav @ 0x10338f000] After avformat_find_stream_info() pos: 897070 bytes
 read:917504 seeks:0 frames:218
 Guessed Channel Layout for  Input Stream #4.0 : stereo
 Input #4, wav, from 'in.wav':
   Duration: 00:00:09.50, bitrate: 1411 kb/s
     Stream #4:0, 218, 1/44100: Audio: pcm_s16le ([1][0][0][0] / 0x0001),
 44100 Hz, stereo, s16, 1411 kb/s
 Successfully opened the file.
 Parsing a group of options: output file out.ac3.
 Applying option map (set input stream mapping) with argument [ac].
 Applying option t (record or transcode "duration" seconds of audio/video)
 with argument 5.
 Successfully parsed a group of options.
 Opening an output file: out.ac3.
 detected 4 logical cores
 [Parsed_amerge_0 @ 0x102a59260] Setting 'inputs' to value '5'
 [Parsed_pan_1 @ 0x102a59540] compat: called with
 args=[stereo|FL=0.5*c0+0.2*c2+0.1*c4+0.1*c6+0.1*c8|FR=0.5*c1+0.2*c3+0.1*c5+0.1*c7+0.1*c9]
 [Parsed_pan_1 @ 0x102a59540] Setting 'args' to value
 'stereo|FL=0.5*c0+0.2*c2+0.1*c4+0.1*c6+0.1*c8|FR=0.5*c1+0.2*c3+0.1*c5+0.1*c7+0.1*c9'
 [graph 0 input from stream 0:0 @ 0x102a59660] Setting 'time_base' to value
 '1/44100'
 [graph 0 input from stream 0:0 @ 0x102a59660] Setting 'sample_rate' to
 value '44100'
 [graph 0 input from stream 0:0 @ 0x102a59660] Setting 'sample_fmt' to
 value 's16'
 [graph 0 input from stream 0:0 @ 0x102a59660] Setting 'channel_layout' to
 value '0x3'
 [graph 0 input from stream 0:0 @ 0x102a59660] tb:1/44100 samplefmt:s16
 samplerate:44100 chlayout:0x3
 [graph 0 input from stream 1:0 @ 0x102a59f00] Setting 'time_base' to value
 '1/44100'
 [graph 0 input from stream 1:0 @ 0x102a59f00] Setting 'sample_rate' to
 value '44100'
 [graph 0 input from stream 1:0 @ 0x102a59f00] Setting 'sample_fmt' to
 value 's16'
 [graph 0 input from stream 1:0 @ 0x102a59f00] Setting 'channel_layout' to
 value '0x3'
 [graph 0 input from stream 1:0 @ 0x102a59f00] tb:1/44100 samplefmt:s16
 samplerate:44100 chlayout:0x3
 [graph 0 input from stream 2:0 @ 0x102a5a380] Setting 'time_base' to value
 '1/44100'
 [graph 0 input from stream 2:0 @ 0x102a5a380] Setting 'sample_rate' to
 value '44100'
 [graph 0 input from stream 2:0 @ 0x102a5a380] Setting 'sample_fmt' to
 value 's16'
 [graph 0 input from stream 2:0 @ 0x102a5a380] Setting 'channel_layout' to
 value '0x3'
 [graph 0 input from stream 2:0 @ 0x102a5a380] tb:1/44100 samplefmt:s16
 samplerate:44100 chlayout:0x3
 [graph 0 input from stream 3:0 @ 0x102a5a5a0] Setting 'time_base' to value
 '1/44100'
 [graph 0 input from stream 3:0 @ 0x102a5a5a0] Setting 'sample_rate' to
 value '44100'
 [graph 0 input from stream 3:0 @ 0x102a5a5a0] Setting 'sample_fmt' to
 value 's16'
 [graph 0 input from stream 3:0 @ 0x102a5a5a0] Setting 'channel_layout' to
 value '0x3'
 [graph 0 input from stream 3:0 @ 0x102a5a5a0] tb:1/44100 samplefmt:s16
 samplerate:44100 chlayout:0x3
 [graph 0 input from stream 4:0 @ 0x102a5a8a0] Setting 'time_base' to value
 '1/44100'
 [graph 0 input from stream 4:0 @ 0x102a5a8a0] Setting 'sample_rate' to
 value '44100'
 [graph 0 input from stream 4:0 @ 0x102a5a8a0] Setting 'sample_fmt' to
 value 's16'
 [graph 0 input from stream 4:0 @ 0x102a5a8a0] Setting 'channel_layout' to
 value '0x3'
 [graph 0 input from stream 4:0 @ 0x102a5a8a0] tb:1/44100 samplefmt:s16
 samplerate:44100 chlayout:0x3
 [audio format for output stream 0:0 @ 0x102a5b140] Setting 'sample_fmts'
 to value 'fltp'
 [audio format for output stream 0:0 @ 0x102a5b140] Setting
 'channel_layouts' to value
 '0x4|0x3|0x103|0x7|0x603|0x33|0x107|0x607|0x37|0xc|0xb|0x10b|0xf|0x60b|0x3b|0x10f|0x60f|0x3f'
 Successfully opened the file.
 [Parsed_amerge_0 @ 0x102a59260] No channel layout for input 1
 [AVFilterGraph @ 0x102a59100] query_formats: 9 queried, 9 merged, 0
 already done, 18 delayed
 [AVFilterGraph @ 0x102a59100] query_formats not finished
 [Parsed_amerge_0 @ 0x102a59260] Input channel layouts overlap: output
 layout will be determined by the number of distinct input channels
 [Parsed_pan_1 @ 0x102a59540] auto-inserting filter 'auto-inserted
 resampler 0' between the filter 'Parsed_amerge_0' and the filter
 'Parsed_pan_1'
 [AVFilterGraph @ 0x102a59100] query_formats: 1 queried, 15 merged, 12
 already done, 0 delayed
 [Parsed_amerge_0 @ 0x102a59260] in0:stereo + in1:stereo + in2:stereo +
 in3:stereo + in4:stereo -> out:10 channels
 (FL+FR+FC+LFE+BL+BR+FLC+FRC+BC+SL)
 [auto-inserted resampler 0 @ 0x102a11c00] ch:10 chl:10 channels
 (FL+FR+FC+LFE+BL+BR+FLC+FRC+BC+SL) fmt:s16 r:44100Hz -> ch:10 chl:10
 channels (FL+FR+FC+LFE+BL+BR+FLC+FRC+BC+SL) fmt:fltp r:44100Hz
 [Parsed_pan_1 @ 0x102a59540] o0 = 0.5 i0 + 0 i1 + 0.2 i2 + 0 i3 + 0.1 i4 +
 0 i5 + 0.1 i6 + 0 i7 + 0.1 i8 + 0 i9
 [Parsed_pan_1 @ 0x102a59540] o1 = 0 i0 + 0.5 i1 + 0 i2 + 0.2 i3 + 0 i4 +
 0.1 i5 + 0 i6 + 0.1 i7 + 0 i8 + 0.1 i9
 Output #0, ac3, to 'out.ac3':
   Metadata:
     encoder         : Lavf55.31.100
     Stream #0:0, 0, 1/90000: Audio: ac3, 44100 Hz, stereo, fltp, 192 kb/s
 (default)
 Stream mapping:
   Stream #0:0 (pcm_s16le) -> amerge:in0
   Stream #1:0 (pcm_s16le) -> amerge:in1
   Stream #2:0 (pcm_s16le) -> amerge:in2
   Stream #3:0 (pcm_s16le) -> amerge:in3
   Stream #4:0 (pcm_s16le) -> amerge:in4
   pan -> Stream #0:0 (ac3)
 Press [q] to stop, [?] for help
 Segmentation fault
 $
 }}}

 {{{
 Program received signal EXC_BAD_ACCESS, Could not access memory.
 Reason: KERN_INVALID_ADDRESS at address: 0x0000000000001080
 0x000000010074ae17 in swri_rematrix (s=0x103085400, out=0x103087000,
 in=0x103086b80, len=1024, mustcopy=1) at libswresample/rematrix.c:474
 474                             v+= ((float*)in->ch[in_i])[i] *
 s->matrix[out_i][in_i];
 (gdb) bt
 #0  0x000000010074ae17 in swri_rematrix (s=0x103085400, out=0x103087000,
 in=0x103086b80, len=1024, mustcopy=1) at libswresample/rematrix.c:474
 #1  0x000000010074f16e in swr_convert_internal (s=0x103085400,
 out=0x103087000, out_count=1024, in=0x103086b80, in_count=1024) at
 libswresample/swresample.c:681
 (gdb) p in->ch
 $1 = {0x10400a000 "", 0x10400b200 "", 0x10400c400 "", 0x10400d600 "",
 0x10400e800 "", 0x10400fa00 "", 0x104010c00 "", 0x104011e00 "", 0x1080
 <Address 0x1080 out of bounds>, 0x0 <repeats 23 times>}
 (gdb)
 }}}

 This longer stack trace is from a slightly older version with a different
 input file:
 {{{
 0x000000010080086c swri_rematrix + 1084 (rematrix.c:474)
 0x0000000100805f71 swr_convert_internal + 577 (swresample.c:689)
 0x0000000100806a80 swr_convert + 1392 (swresample.c:822)
 0x00000001000308c9 filter_frame + 105 (af_pan.c:374)
 0x000000010003ae0e ff_filter_frame_framed + 590 (avfilter.c:1081)
 0x000000010003b1d3 ff_filter_frame + 67 (avfilter.c:1163)
 0x00000001000262df filter_frame + 399 (af_aresample.c:215)
 0x000000010003ae0e ff_filter_frame_framed + 590 (avfilter.c:1081)
 0x000000010003b1d3 ff_filter_frame + 67 (avfilter.c:1163)
 0x0000000100023c82 filter_frame + 2290 (af_amerge.c:303)
 0x000000010003ae0e ff_filter_frame_framed + 590 (avfilter.c:1081)
 0x000000010003b1d3 ff_filter_frame + 67 (avfilter.c:1163)
 0x000000010003f74f request_frame + 63 (buffersrc.c:501)
 0x000000010003fd31 av_buffersrc_add_frame_internal + 305 (buffersrc.c:181)
 0x000000010003fe8f av_buffersrc_add_frame_flags + 79 (buffersrc.c:106)
 0x00000001000171a6 output_packet + 7542 (ffmpeg.c:1716)
 0x00000001000189fa process_input + 4378 (ffmpeg.c:3270)
 0x000000010001b20f transcode_step + 383 (ffmpeg.c:3364)
 0x000000010001d177 transcode + 7463 (ffmpeg.c:3417)
 0x000000010001dd16 main + 230 (ffmpeg.c:3596)
 0x0000000100001014 start + 52
 }}}

--
Ticket URL: <https://trac.ffmpeg.org/ticket/3380>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list