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

avprobe.c:298:16: Call
296.     AVDictionaryEntry *t;
297. 
298.     if ((err = avformat_open_input(&fmt_ctx, filename,
                    ^
299.                                    iformat, &format_opts)) < 0) {
300.         print_error(filename, err);

libavformat/utils.c:501:1: Parameter `(*ps)->nb_programs`
  499. }
  500. 
  501. int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputFormat *fmt, AVDictionary **options)
       ^
  502. {
  503.     AVFormatContext *s = *ps;

libavformat/utils.c:570:5: Call
  568.     if (s->pb && !(s->flags & AVFMT_FLAG_CUSTOM_IO))
  569.         avio_close(s->pb);
  570.     avformat_free_context(s);
           ^
  571.     *ps = NULL;
  572.     return ret;

libavformat/utils.c:2545:1: <LHS trace>
2543. }
2544. 
2545. void avformat_free_context(AVFormatContext *s)
      ^
2546. {
2547.     int i;

libavformat/utils.c:2545:1: Parameter `s->nb_programs`
    2543. }
    2544. 
    2545. void avformat_free_context(AVFormatContext *s)
          ^
    2546. {
    2547.     int i;

libavformat/utils.c:2570:9: Binary operation: ([0, +oo] - 1):unsigned32 by call to `avformat_open_input` 
    2568.         av_free(st);
    2569.     }
    2570.     for(i=s->nb_programs-1; i>=0; i--) {
                  ^
    2571.         av_dict_free(&s->programs[i]->metadata);
    2572.         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 open_input_file(AVFormatContext **fmt_ctx_ptr, const char *filename)\n{\n    int err, i;\n    AVFormatContext *fmt_ctx = NULL;\n    AVDictionaryEntry *t;\n    if ((err = avformat_open_input(&fmt_ctx, filename,\n                                   iformat, &format_opts)) < 0) {\n        print_error(filename, err);\n        return err;\n    }\n    if ((t = av_dict_get(format_opts, "", NULL, AV_DICT_IGNORE_SUFFIX))) {\n        av_log(NULL, AV_LOG_ERROR, "Option %s not found.\\n", t->key);\n        return AVERROR_OPTION_NOT_FOUND;\n    }\n    if ((err = avformat_find_stream_info(fmt_ctx, NULL)) < 0) {\n        print_error(filename, err);\n        return err;\n    }\n    av_dump_format(fmt_ctx, 0, filename, 0);\n    for (i = 0; i < fmt_ctx->nb_streams; i++) {\n        AVStream *stream = fmt_ctx->streams[i];\n        AVCodec *codec;\n        if (!(codec = avcodec_find_decoder(stream->codec->codec_id))) {\n            fprintf(stderr,\n                    "Unsupported codec with id %d for input stream %d\\n",\n                    stream->codec->codec_id, stream->index);\n        } else if (avcodec_open2(stream->codec, codec, NULL) < 0) {\n            fprintf(stderr, "Error while opening codec for input stream %d\\n",\n                    stream->index);\n        }\n    }\n    *fmt_ctx_ptr = fmt_ctx;\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    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, &tmp)) < 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)) < 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}']