[FFmpeg-trac] #7241(avcodec:new): DNxHD segfault on completion in dnxhd_encode_end when using 34 or more threads

FFmpeg trac at avcodec.org
Fri Jun 1 01:40:16 EEST 2018


#7241: DNxHD segfault on completion in dnxhd_encode_end when using 34 or more
threads
---------------------------------+--------------------------------------
             Reporter:  gammie   |                     Type:  defect
               Status:  new      |                 Priority:  normal
            Component:  avcodec  |                  Version:  git-master
             Keywords:  DNxHD    |               Blocked By:
             Blocking:           |  Reproduced by developer:  0
Analyzed by developer:  0        |
---------------------------------+--------------------------------------
 Summary of the bug:
 If you run an encode to DNxHD with 34 or more threads, you cause a
 segfault on attempting `av_freep(&ctx->thread[33])`. I believe this is
 related to #6592 and its solution 28e9ba951d1a0b0aca53b242aa64f484ca75e874
 which are both associated with the addition of frame threading in the
 DNxHD encoder. I have reproduced this issue on today's git-master
 (04b570817b2b38e35675b17328239746212f4c3f) and n4.0. This issue does not
 occur in n3.0 where the encoder works fine with 48 threads.

 How to reproduce:
 {{{
 ffmpeg -f lavfi -i testsrc=duration=1:size=1280x720:rate=60000/1001
 -vcodec dnxhd -b:v 145M -pix_fmt yuv422p -threads 34 -f mxf /dev/null

 ffmpeg version N-91202-g04b5708 Copyright (c) 2000-2018 the FFmpeg
 developers
   built with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
   configuration: --enable-static --disable-shared --disable-ffplay
 --disable-doc --extra-cflags=-static --extra-libs='-lpng -lm -ldl
 -lpthread' --enable-gpl --enable-bzlib --enable-zlib --enable-postproc
 --enable-runtime-cpudetect --enable-libtheora --enable-libvorbis --enable-
 libmp3lame --enable-gray --enable-libfreetype --enable-libopenjpeg
 --enable-libspeex --enable-version3 --extra-ldflags=-static --pkg-config-
 flags=--static
   libavutil      56. 18.102 / 56. 18.102
   libavcodec     58. 19.104 / 58. 19.104
   libavformat    58. 17.100 / 58. 17.100
   libavdevice    58.  4.100 / 58.  4.100
   libavfilter     7. 24.100 /  7. 24.100
   libswscale      5.  2.100 /  5.  2.100
   libswresample   3.  2.100 /  3.  2.100
   libpostproc    55.  2.100 / 55.  2.100
 Input #0, lavfi, from 'testsrc=duration=1:size=1280x720:rate=60000/1001':
   Duration: N/A, start: 0.000000, bitrate: N/A
     Stream #0:0: Video: rawvideo (RGB[24] / 0x18424752), rgb24, 1280x720
 [SAR 1:1 DAR 16:9], 59.94 tbr, 59.94 tbn, 59.94 tbc
 Stream mapping:
   Stream #0:0 -> #0:0 (rawvideo (native) -> dnxhd (native))
 Press [q] to stop, [?] for help
 Output #0, mxf, to '/dev/null':
   Metadata:
     encoder         : Lavf58.17.100
     Stream #0:0: Video: dnxhd (DNXHD), yuv422p, 1280x720 [SAR 1:1 DAR
 16:9], q=2-1024, 145000 kb/s, 59.94 fps, 59.94 tbn, 59.94 tbc
     Metadata:
       encoder         : Lavc58.19.104 dnxhd
 [Parsed_testsrc_0 @ 0x4531f00] EOF timestamp not reliable
 frame=   60 fps= 57 q=1.0 Lsize=   17826kB time=00:00:01.00
 bitrate=145885.1kbits/s speed=0.95x
 video:17760kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
 muxing overhead: 0.371869%
 Segmentation fault
 }}}
 {{{
 Program received signal SIGSEGV, Segmentation fault.
 0x00000000012b0449 in free ()
 (gdb) bt
 #0  0x00000000012b0449 in free ()
 #1  0x0000000001095942 in av_free (ptr=<optimized out>) at
 libavutil/mem.c:223
 #2  av_freep (arg=<optimized out>) at libavutil/mem.c:233
 #3  0x0000000000421a71 in dnxhd_encode_end (avctx=0x2629bc0) at
 libavcodec/dnxhdenc.c:1373
 #4  0x0000000000449740 in avcodec_close (avctx=avctx at entry=0x2629bc0) at
 libavcodec/utils.c:1077
 #5  0x00000000009fd569 in avcodec_free_context (pavctx=0x26299e0) at
 libavcodec/options.c:178
 #6  0x00000000004a42e0 in ffmpeg_cleanup (ret=0) at fftools/ffmpeg.c:571
 #7  0x0000000000492f71 in exit_program (ret=0) at fftools/cmdutils.c:139
 #8  0x0000000000484af8 in main (argc=<optimized out>, argv=0x7fffffffe598)
 at fftools/ffmpeg.c:4855
 }}}

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


More information about the FFmpeg-trac mailing list