[FFmpeg-trac] #21(FFmpeg:open): Segfault converting m2t file with ac3 audio track when number of audio channels changes.

FFmpeg trac at avcodec.org
Mon Mar 28 10:53:54 CEST 2011


#21: Segfault converting m2t file with ac3 audio track when number of audio
channels changes.
---------------------------------------------+----------------------
Reporter:  vk5ztv                            |       Owner:  michael
    Type:  defect                            |      Status:  open
Priority:  critical                          |   Component:  FFmpeg
 Version:  git                               |  Resolution:
Keywords:  crash, segfault, invalid pointer  |  Blocked By:
Blocking:                                    |  Reproduced:  1
Analyzed:  0                                 |
---------------------------------------------+----------------------
Changes (by cehoyos):

 * priority:  important => critical
 * status:  new => open
 * reproduced:  0 => 1


Comment:

 Looks critical to me, work-around is to use -acodec ac3_fixed.

 Reproducible with
 {{{
 $ make fate-acodec-ac3_fixed
 $ ./ffmpeg -i tests/data/acodec/ac3.rm -acodec ac3 -ac 6 out.ac3
 }}}
 This is a regression because the following works as expected:
 {{{
 $ ./ffmpeg -i tests/data/acodec/ac3.rm -acodec ac3_fixed -ac 6 out.ac3
 }}}

 {{{
 $ valgrind ./ffmpeg_g -i tests/data/acodec/ac3.rm -ac 6 out.ac3
 FFmpeg version git-N-28658-gc1c2f49, Copyright (c) 2000-2011 the FFmpeg
 developers
   built on Mar 28 2011 10:39:35 with gcc 4.5.2
   configuration: --cc='/usr/local/gcc-4.5.2/bin/gcc -m32'
   libavutil    50. 40. 0 / 50. 40. 0
   libavcodec   52.115. 0 / 52.115. 0
   libavformat  52.103. 0 / 52.103. 0
   libavdevice  52.  3. 0 / 52.  3. 0
   libavfilter   1. 76. 0 /  1. 76. 0
   libswscale    0. 13. 0 /  0. 13. 0
 Input #0, rm, from 'tests/data/acodec/ac3.rm':
   Metadata:
     title           :
     author          :
     copyright       :
     comment         :
   Duration: 00:00:06.02, start: 0.000000, bitrate: 131 kb/s
     Stream #0.0: Audio: ac3, 44100 Hz, stereo, s16, 128 kb/s
 Incompatible sample format 's16' for codec 'ac3', auto-selecting format
 'flt'
 [ac3 @ 0x7c17540] No channel layout specified. The encoder will guess the
 layout, but it might be incorrect.
 Output #0, ac3, to 'out.ac3':
   Metadata:
     title           :
     author          :
     copyright       :
     comment         :
     encoder         : Lavf52.103.0
     Stream #0.0: Audio: ac3, 44100 Hz, 5.1, flt, 64 kb/s
 Stream mapping:
   Stream #0.0 -> #0.0
 Press ctrl-c to stop encoding
 ==22325== Invalid write of size 2
 ==22325==    at 0x8309928: audio_resample (resample.c:139)
 ==22325==  Address 0x7d96292 is 2 bytes after a block of size 6,160
 alloc'd
 ==22325==    at 0x6449E9E: memalign (in
 /usr/lib64/valgrind/vgpreload_memcheck-x86-linux.so)
 ==22325==    by 0x6449EFB: posix_memalign (in
 /usr/lib64/valgrind/vgpreload_memcheck-x86-linux.so)
 ==22325==    by 0x85199D0: av_malloc (mem.c:83)

 ...
 }}}

 I don't get a backtrace with above sample, but with the following:
 {{{
 $ ffmpeg -i test.ts -acodec ac3 -sn -vn -map 0.2 -ac 6 test.mkv
 FFmpeg version git-N-28658-gc1c2f49, Copyright (c) 2000-2011 the FFmpeg
 developers
   built on Mar 27 2011 01:00:04 with gcc 4.5.2
   configuration: --cc=/usr/local/gcc-4.5.2/bin/gcc --enable-gpl
   libavutil    50. 40. 0 / 50. 40. 0
   libavcodec   52.115. 0 / 52.115. 0
   libavformat  52.103. 0 / 52.103. 0
   libavdevice  52.  3. 0 / 52.  3. 0
   libavfilter   1. 76. 0 /  1. 76. 0
   libswscale    0. 13. 0 /  0. 13. 0
 [mpegts @ 0x11f0650] max_analyze_duration reached
 [NULL @ 0x12179f0] start time is not set in av_estimate_timings_from_pts
 [NULL @ 0x121b870] start time is not set in av_estimate_timings_from_pts
 [NULL @ 0x121d7d0] start time is not set in av_estimate_timings_from_pts
 [NULL @ 0x121f730] start time is not set in av_estimate_timings_from_pts
 [NULL @ 0x1221690] start time is not set in av_estimate_timings_from_pts
 [NULL @ 0x12235f0] start time is not set in av_estimate_timings_from_pts
 Input #0, mpegts, from 'test.ts':
   Duration: 00:00:21.79, start: 58590.442822, bitrate: 3849 kb/s
   Program 10101
   Program 10102
     Stream #0.0[0x3fc]: Video: mpeg2video (Main), yuv420p, 720x576 [PAR
 64:45 DAR 16:9], 4300 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
     Stream #0.1[0x3fd](ger): Audio: mp2, 48000 Hz, stereo, s16, 160 kb/s
 (clean effects)
     Stream #0.2[0x3ff](ger): Audio: ac3, 48000 Hz, stereo, s16, 448 kb/s
 (clean effects)
     Stream #0.3[0x400]: Data: [6][0][0][0] / 0x0006
     Stream #0.4[0x401](ger): Subtitle: [6][0][0][0] / 0x0006
     Stream #0.5[0x1b63]: Data: [11][0][0][0] / 0x000B
     Stream #0.6[0x1b64]: Data: [11][0][0][0] / 0x000B
     Stream #0.7[0x1b6d]: Data: [11][0][0][0] / 0x000B
     Stream #0.8[0x1b77]: Data: [11][0][0][0] / 0x000B
     Stream #0.9[0x1bbe]: Data: [5][0][0][0] / 0x0005
   Program 10120
   Program 10122
 Incompatible sample format 's16' for codec 'ac3', auto-selecting format
 'flt'
 [ac3 @ 0x121a1a0] No channel layout specified. The encoder will guess the
 layout, but it might be incorrect.
 Output #0, matroska, to 'out.mkv':
   Metadata:
     encoder         : Lavf52.103.0
     Stream #0.0(ger): Audio: ac3, 48000 Hz, 5.1, flt, 64 kb/s (clean
 effects)
 Stream mapping:
   Stream #0.1 -> #0.0
 Press ctrl-c to stop encoding

 Program received signal SIGSEGV, Segmentation fault.
 0x00007ffff6d76a24 in ?? () from /lib64/libc.so.6
 (gdb) bt
 #0  0x00007ffff6d76a24 in ?? () from /lib64/libc.so.6
 #1  0x00007ffff6d78ae9 in malloc () from /lib64/libc.so.6
 #2  0x00007ffff6d792c9 in posix_memalign () from /lib64/libc.so.6
 #3  0x00000000008e65c9 in av_malloc (size=<value optimized out>) at
 libavutil/mem.c:83
 #4  0x00000000006dc0b6 in audio_resample (s=0x121cd40, output=0x1285f60,
 input=0x12d5ee0, nb_samples=1152) at libavcodec/resample.c:297
 #5  0x0000000000407fd6 in do_audio_out (size=4608, buf=<value optimized
 out>, ist=0x121a7e0, ost=0x1219520, s=0x12182a0) at ffmpeg.c:865
 #6  output_packet (size=4608, buf=<value optimized out>, ist=0x121a7e0,
 ost=0x1219520, s=0x12182a0) at ffmpeg.c:1624
 #7  0x000000000040b13e in transcode (nb_output_files=1, nb_input_files=1,
 stream_maps=0x0, nb_stream_maps=18810448, input_files=0xca6900,
 output_files=0xca65e0) at ffmpeg.c:2604
 #8  0x000000000040fa8f in main (argc=<value optimized out>, argv=<value
 optimized out>) at ffmpeg.c:4349
 }}}

-- 
Ticket URL: <http://avcodec.org/trac/ffmpeg/ticket/21#comment:1>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list