[FFmpeg-trac] #7527(avformat:new): segfault in libavformat/hlsenc.c hls_delete_old_segments()

FFmpeg trac at avcodec.org
Wed Oct 31 23:55:47 EET 2018

#7527: segfault in libavformat/hlsenc.c hls_delete_old_segments()
             Reporter:  caspy        |                     Type:  defect
               Status:  new          |                 Priority:  important
            Component:  avformat     |                  Version:  git-
             Keywords:  hls          |  master
  delete_segments strftime_mkdir     |               Blocked By:
  use_localtime_mkdir                |  Reproduced by developer:  0
             Blocking:               |
Analyzed by developer:  0            |
 Summary of the bug:

 ffmpeg will segfault when output as HLS with hls_flag +delete_segments and

 How to reproduce:
 % ffmpeg -i rtmp:// -c copy -f hls -hls_time 1
 -hls_list_size 1 -use_localtime 1 -use_localtime_mkdir 1 -hls_flags
 "delete_segments" -hls_segment_filename "/tmp/%s/%s.ts" /tmp/index.m3u8

 ffmpeg version: found in release/4.0, but git-master branch share same


 in libavformat/hlsenc.c:
 in hls_delete_old_segments():
 'dirname' is created as NULL
 then, few lines bellow, it is assigned only if 'if (segment &&
 !hls->use_localtime_mkdir) { .. dirname = .. }'
 and few more lines bellow it is accessed (crash is here) as
 'av_stristr(dirname, "%v")'

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

More information about the FFmpeg-trac mailing list