avconv.c:3400: error: Integer Overflow L2
  ([0, +oo] - 1):unsigned32 by call to `avformat_open_input`.

avconv.c:3400:11: Call
3398.     AVFormatContext *ic = NULL;
3399. 
3400.     err = avformat_open_input(&ic, filename, NULL, NULL);
                ^
3401.     if (err < 0)
3402.         return err;

libavformat/utils.c:596:1: Parameter `(*ps)->nb_programs`
  594. }
  595. 
  596. int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputFormat *fmt, AVDictionary **options)
       ^
  597. {
  598.     AVFormatContext *s = *ps;

libavformat/utils.c:666:5: Call
  664.     if (s->pb && !(s->flags & AVFMT_FLAG_CUSTOM_IO))
  665.         avio_close(s->pb);
  666.     avformat_free_context(s);
           ^
  667.     *ps = NULL;
  668.     return ret;

libavformat/utils.c:2606:1: <LHS trace>
2604. }
2605. 
2606. void avformat_free_context(AVFormatContext *s)
      ^
2607. {
2608.     int i;

libavformat/utils.c:2606:1: Parameter `s->nb_programs`
    2604. }
    2605. 
    2606. void avformat_free_context(AVFormatContext *s)
          ^
    2607. {
    2608.     int i;

libavformat/utils.c:2631:9: Binary operation: ([0, +oo] - 1):unsigned32 by call to `avformat_open_input` 
    2629.         av_free(st);
    2630.     }
    2631.     for(i=s->nb_programs-1; i>=0; i--) {
                  ^
    2632.         av_dict_free(&s->programs[i]->metadata);
    2633.         av_freep(&s->programs[i]->stream_index);

void avformat_free_context(AVFormatContext *s)
{
    int i;
    AVStream *st;
    av_opt_free(s);
    if (s->iformat && s->iformat->priv_class && s->priv_data)
        av_opt_free(s->priv_data);
    for(i=0;i<s->nb_streams;i++) {
        st = s->streams[i];
        if (st->parser) {
            av_parser_close(st->parser);
            av_free_packet(&st->cur_pkt);
        }
        av_dict_free(&st->metadata);
        av_free(st->index_entries);
        av_free(st->codec->extradata);
        av_free(st->codec->subtitle_header);
        av_free(st->codec);
        av_free(st->priv_data);
        av_free(st->info);
        av_free(st);
    }
    for(i=s->nb_programs-1; i>=0; i--) {
        av_dict_free(&s->programs[i]->metadata);
        av_freep(&s->programs[i]->stream_index);
        av_freep(&s->programs[i]);
    }
    av_freep(&s->programs);
    av_freep(&s->priv_data);
    while(s->nb_chapters--) {
        av_dict_free(&s->chapters[s->nb_chapters]->metadata);
        av_free(s->chapters[s->nb_chapters]);
    }
    av_freep(&s->chapters);
    av_dict_free(&s->metadata);
    av_freep(&s->streams);
    av_free(s);
}
['static int read_avserver_streams(AVFormatContext *s, const char *filename)\n{\n    int i, err;\n    AVFormatContext *ic = NULL;\n    err = avformat_open_input(&ic, filename, NULL, NULL);\n    if (err < 0)\n        return err;\n    for(i=0;i<ic->nb_streams;i++) {\n        AVStream *st;\n        OutputStream *ost;\n        AVCodec *codec;\n        codec = avcodec_find_encoder(ic->streams[i]->codec->codec_id);\n        ost   = new_output_stream(s, codec->type);\n        st    = ost->st;\n        memcpy(st, ic->streams[i], sizeof(AVStream));\n        st->info = NULL;\n        avcodec_copy_context(st->codec, ic->streams[i]->codec);\n        if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && !st->stream_copy)\n            choose_sample_fmt(st, codec);\n        else if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO && !st->stream_copy)\n            choose_pixel_fmt(st, codec);\n    }\n    av_close_input_file(ic);\n    return 0;\n}', 'int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputFormat *fmt, AVDictionary **options)\n{\n    AVFormatContext *s = *ps;\n    int ret = 0;\n    AVFormatParameters ap = { { 0 } };\n    AVDictionary *tmp = NULL;\n    if (!s && !(s = avformat_alloc_context()))\n        return AVERROR(ENOMEM);\n    if (fmt)\n        s->iformat = fmt;\n    if (options)\n        av_dict_copy(&tmp, *options, 0);\n    if ((ret = av_opt_set_dict(s, &tmp)) < 0)\n        goto fail;\n    if ((ret = init_input(s, filename)) < 0)\n        goto fail;\n    if (s->iformat->flags & AVFMT_NEEDNUMBER) {\n        if (!av_filename_number_test(filename)) {\n            ret = AVERROR(EINVAL);\n            goto fail;\n        }\n    }\n    s->duration = s->start_time = AV_NOPTS_VALUE;\n    av_strlcpy(s->filename, filename, sizeof(s->filename));\n    if (s->iformat->priv_data_size > 0) {\n        if (!(s->priv_data = av_mallocz(s->iformat->priv_data_size))) {\n            ret = AVERROR(ENOMEM);\n            goto fail;\n        }\n        if (s->iformat->priv_class) {\n            *(const AVClass**)s->priv_data = s->iformat->priv_class;\n            av_opt_set_defaults(s->priv_data);\n            if ((ret = av_opt_set_dict(s->priv_data, &tmp)) < 0)\n                goto fail;\n        }\n    }\n    if (s->pb)\n        ff_id3v2_read(s, ID3v2_DEFAULT_MAGIC);\n    if (s->iformat->read_header)\n        if ((ret = s->iformat->read_header(s, &ap)) < 0)\n            goto fail;\n    if (s->pb && !s->data_offset)\n        s->data_offset = avio_tell(s->pb);\n    s->raw_packet_buffer_remaining_size = RAW_PACKET_BUFFER_SIZE;\n    if (options) {\n        av_dict_free(options);\n        *options = tmp;\n    }\n    *ps = s;\n    return 0;\nfail:\n    av_dict_free(&tmp);\n    if (s->pb && !(s->flags & AVFMT_FLAG_CUSTOM_IO))\n        avio_close(s->pb);\n    avformat_free_context(s);\n    *ps = NULL;\n    return ret;\n}', 'void avformat_free_context(AVFormatContext *s)\n{\n    int i;\n    AVStream *st;\n    av_opt_free(s);\n    if (s->iformat && s->iformat->priv_class && s->priv_data)\n        av_opt_free(s->priv_data);\n    for(i=0;i<s->nb_streams;i++) {\n        st = s->streams[i];\n        if (st->parser) {\n            av_parser_close(st->parser);\n            av_free_packet(&st->cur_pkt);\n        }\n        av_dict_free(&st->metadata);\n        av_free(st->index_entries);\n        av_free(st->codec->extradata);\n        av_free(st->codec->subtitle_header);\n        av_free(st->codec);\n        av_free(st->priv_data);\n        av_free(st->info);\n        av_free(st);\n    }\n    for(i=s->nb_programs-1; i>=0; i--) {\n        av_dict_free(&s->programs[i]->metadata);\n        av_freep(&s->programs[i]->stream_index);\n        av_freep(&s->programs[i]);\n    }\n    av_freep(&s->programs);\n    av_freep(&s->priv_data);\n    while(s->nb_chapters--) {\n        av_dict_free(&s->chapters[s->nb_chapters]->metadata);\n        av_free(s->chapters[s->nb_chapters]);\n    }\n    av_freep(&s->chapters);\n    av_dict_free(&s->metadata);\n    av_freep(&s->streams);\n    av_free(s);\n}']