libavformat/segment.c:333: error: Integer Overflow L2
  ([0, +oo] - 1):unsigned32 by call to `seg_free_context`.

libavformat/segment.c:329:11: Call
327.     }
328. 
329.     ret = ff_write_chained(oc, pkt->stream_index, pkt, s);
               ^
330. 
331. fail:

libavformat/mux.c:656:12: Call
  654.                                      src->streams[pkt->stream_index]->time_base,
  655.                                      dst->streams[dst_stream]->time_base);
  656.     return av_write_frame(dst, &local_pkt);
                  ^
  657. }

libavformat/mux.c:402:9: Assignment
    400. 
    401.     if (ret >= 0)
    402.         s->streams[pkt->stream_index]->nb_frames++;
                 ^
    403.     return ret;
    404. }

libavformat/segment.c:333:9: Call
331. fail:
332.     if (ret < 0)
333.         seg_free_context(seg);
             ^
334. 
335.     return ret;

libavformat/segment.c:187:1: Parameter `seg->avf->nb_programs`
  185. }
  186. 
  187. static void seg_free_context(SegmentContext *seg)
       ^
  188. {
  189.     avio_closep(&seg->pb);

libavformat/segment.c:190:5: Call
  188. {
  189.     avio_closep(&seg->pb);
  190.     avformat_free_context(seg->avf);
           ^
  191.     seg->avf = NULL;
  192. }

libavformat/utils.c:2432:1: <LHS trace>
2430. }
2431. 
2432. void avformat_free_context(AVFormatContext *s)
      ^
2433. {
2434.     int i, j;

libavformat/utils.c:2432:1: Parameter `s->nb_programs`
    2430. }
    2431. 
    2432. void avformat_free_context(AVFormatContext *s)
          ^
    2433. {
    2434.     int i, j;

libavformat/utils.c:2468:10: Binary operation: ([0, +oo] - 1):unsigned32 by call to `seg_free_context` 
    2466.         av_free(st);
    2467.     }
    2468.     for (i = s->nb_programs - 1; i >= 0; i--) {
                   ^
    2469.         av_dict_free(&s->programs[i]->metadata);
    2470.         av_freep(&s->programs[i]->stream_index);
