avconv.c:2956: error: Integer Overflow R2
  ([0, +oo] + [0, +oo]):signed32 by call to `print_sdp`.

avconv.c:2870:30: Unknown value from: strerror
2868.             const char *errbuf_ptr = errbuf;
2869.             if (av_strerror(ret, errbuf, sizeof(errbuf)) < 0)
2870.                 errbuf_ptr = strerror(AVUNERROR(ret));
                                   ^
2871.             snprintf(error, sizeof(error), "Could not write header for output file #%d (incorrect codec parameters ?): %s", i, errbuf_ptr);
2872.             ret = AVERROR(EINVAL);

avconv.c:2956:9: Call
2954. 
2955.     if (want_sdp) {
2956.         print_sdp();
              ^
2957.     }
2958. 

avconv.c:2479:1: Parameter `sdp.strlen`
  2477. }
  2478. 
  2479. static void print_sdp(void)
        ^
  2480. {
  2481.     char sdp[2048];

avconv.c:2490:5: Call
  2488.         avc[i] = output_files[i]->ctx;
  2489. 
  2490.     av_sdp_create(avc, nb_output_files, sdp, sizeof(sdp));
            ^
  2491.     printf("SDP:\n%s\n", sdp);
  2492.     fflush(stdout);

libavformat/sdp.c:580:1: Parameter `buf->strlen`
    578. }
    579. 
    580. int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size)
         ^
    581. {
    582.     AVDictionaryEntry *title = av_dict_get(ac[0]->metadata, "title", NULL, 0);

libavformat/sdp.c:611:5: Call
    609.         }
    610.     }
    611.     sdp_write_header(buf, size, &s);
             ^
    612. 
    613.     dst[0] = 0;

libavformat/sdp.c:73:1: Parameter `buff->strlen`
      71. }
      72. 
      73. static void sdp_write_header(char *buff, int size, struct sdp_session_level *s)
          ^
      74. {
      75.     av_strlcatf(buff, size, "v=%d\r\n"

libavformat/sdp.c:75:5: Call
      73. static void sdp_write_header(char *buff, int size, struct sdp_session_level *s)
      74. {
      75.     av_strlcatf(buff, size, "v=%d\r\n"
              ^
      76.                             "o=- %d %d IN %s %s\r\n"
      77.                             "s=%s\r\n",

libavutil/avstring.c:82:1: <LHS trace>
80. }
81. 
82. size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...)
    ^
83. {
84.     int len = strlen(dst);

libavutil/avstring.c:82:1: Parameter `size`
        80. }
        81. 
        82. size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...)
            ^
        83. {
        84.     int len = strlen(dst);

libavutil/avstring.c:88:12: <RHS trace>
86. 
87.     va_start(vl, fmt);
88.     len += vsnprintf(dst + len, size > len ? size - len : 0, fmt, vl);
               ^
89.     va_end(vl);
90. 

libavutil/avstring.c:88:12: Risky value from: vsnprintf
        86. 
        87.     va_start(vl, fmt);
        88.     len += vsnprintf(dst + len, size > len ? size - len : 0, fmt, vl);
                       ^
        89.     va_end(vl);
        90. 

libavutil/avstring.c:88:5: Binary operation: ([0, +oo] + [0, +oo]):signed32 by call to `print_sdp` 
        86. 
        87.     va_start(vl, fmt);
        88.     len += vsnprintf(dst + len, size > len ? size - len : 0, fmt, vl);
                ^
        89.     va_end(vl);
        90. 

size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...)
{
    int len = strlen(dst);
    va_list vl;
    va_start(vl, fmt);
    len += vsnprintf(dst + len, size > len ? size - len : 0, fmt, vl);
    va_end(vl);
    return len;
}
['static int transcode_init(void)\n{\n    int ret = 0, i, j, k;\n    AVFormatContext *oc;\n    AVCodecContext *codec, *icodec;\n    OutputStream *ost;\n    InputStream *ist;\n    char error[1024];\n    int want_sdp = 1;\n    for (i = 0; i < nb_input_files; i++) {\n        InputFile *ifile = input_files[i];\n        if (ifile->rate_emu)\n            for (j = 0; j < ifile->nb_streams; j++)\n                input_streams[j + ifile->ist_index]->start = av_gettime();\n    }\n    for (i = 0; i < nb_output_files; i++) {\n        oc = output_files[i]->ctx;\n        if (!oc->nb_streams && !(oc->oformat->flags & AVFMT_NOSTREAMS)) {\n            av_dump_format(oc, i, oc->filename, 1);\n            av_log(NULL, AV_LOG_ERROR, "Output file #%d does not contain any stream\\n", i);\n            return AVERROR(EINVAL);\n        }\n    }\n    for (i = 0; i < nb_filtergraphs; i++)\n        if ((ret = avfilter_graph_config(filtergraphs[i]->graph, NULL)) < 0)\n            return ret;\n    for (i = 0; i < nb_output_streams; i++) {\n        ost = output_streams[i];\n        oc  = output_files[ost->file_index]->ctx;\n        ist = get_input_stream(ost);\n        if (ost->attachment_filename)\n            continue;\n        codec  = ost->st->codec;\n        if (ist) {\n            icodec = ist->st->codec;\n            ost->st->disposition          = ist->st->disposition;\n            codec->bits_per_raw_sample    = icodec->bits_per_raw_sample;\n            codec->chroma_sample_location = icodec->chroma_sample_location;\n        }\n        if (ost->stream_copy) {\n            uint64_t extra_size;\n            av_assert0(ist && !ost->filter);\n            extra_size = (uint64_t)icodec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE;\n            if (extra_size > INT_MAX) {\n                return AVERROR(EINVAL);\n            }\n            codec->codec_id   = icodec->codec_id;\n            codec->codec_type = icodec->codec_type;\n            if (!codec->codec_tag) {\n                if (!oc->oformat->codec_tag ||\n                     av_codec_get_id (oc->oformat->codec_tag, icodec->codec_tag) == codec->codec_id ||\n                     av_codec_get_tag(oc->oformat->codec_tag, icodec->codec_id) <= 0)\n                    codec->codec_tag = icodec->codec_tag;\n            }\n            codec->bit_rate       = icodec->bit_rate;\n            codec->rc_max_rate    = icodec->rc_max_rate;\n            codec->rc_buffer_size = icodec->rc_buffer_size;\n            codec->field_order    = icodec->field_order;\n            codec->extradata      = av_mallocz(extra_size);\n            if (!codec->extradata) {\n                return AVERROR(ENOMEM);\n            }\n            memcpy(codec->extradata, icodec->extradata, icodec->extradata_size);\n            codec->extradata_size = icodec->extradata_size;\n            if (!copy_tb) {\n                codec->time_base      = icodec->time_base;\n                codec->time_base.num *= icodec->ticks_per_frame;\n                av_reduce(&codec->time_base.num, &codec->time_base.den,\n                          codec->time_base.num, codec->time_base.den, INT_MAX);\n            } else\n                codec->time_base = ist->st->time_base;\n            switch (codec->codec_type) {\n            case AVMEDIA_TYPE_AUDIO:\n                if (audio_volume != 256) {\n                    av_log(NULL, AV_LOG_FATAL, "-acodec copy and -vol are incompatible (frames are not decoded)\\n");\n                    exit_program(1);\n                }\n                codec->channel_layout     = icodec->channel_layout;\n                codec->sample_rate        = icodec->sample_rate;\n                codec->channels           = icodec->channels;\n                codec->frame_size         = icodec->frame_size;\n                codec->audio_service_type = icodec->audio_service_type;\n                codec->block_align        = icodec->block_align;\n                break;\n            case AVMEDIA_TYPE_VIDEO:\n                codec->pix_fmt            = icodec->pix_fmt;\n                codec->width              = icodec->width;\n                codec->height             = icodec->height;\n                codec->has_b_frames       = icodec->has_b_frames;\n                if (!codec->sample_aspect_ratio.num) {\n                    codec->sample_aspect_ratio   =\n                    ost->st->sample_aspect_ratio =\n                        ist->st->sample_aspect_ratio.num ? ist->st->sample_aspect_ratio :\n                        ist->st->codec->sample_aspect_ratio.num ?\n                        ist->st->codec->sample_aspect_ratio : (AVRational){0, 1};\n                }\n                break;\n            case AVMEDIA_TYPE_SUBTITLE:\n                codec->width  = icodec->width;\n                codec->height = icodec->height;\n                break;\n            case AVMEDIA_TYPE_DATA:\n            case AVMEDIA_TYPE_ATTACHMENT:\n                break;\n            default:\n                abort();\n            }\n        } else {\n            if (!ost->enc) {\n                snprintf(error, sizeof(error), "Automatic encoder selection "\n                         "failed for output stream #%d:%d. Default encoder for "\n                         "format %s is probably disabled. Please choose an "\n                         "encoder manually.\\n", ost->file_index, ost->index,\n                         oc->oformat->name);\n                ret = AVERROR(EINVAL);\n                goto dump_format;\n            }\n            if (ist)\n                ist->decoding_needed = 1;\n            ost->encoding_needed = 1;\n            if (codec->codec_type == AVMEDIA_TYPE_VIDEO &&\n                !ost->frame_rate.num && ist &&\n                (video_sync_method ==  VSYNC_CFR ||\n                 (video_sync_method ==  VSYNC_AUTO &&\n                  !(oc->oformat->flags & (AVFMT_NOTIMESTAMPS | AVFMT_VARIABLE_FPS))))) {\n                ost->frame_rate = ist->st->r_frame_rate.num ? ist->st->r_frame_rate : (AVRational){25, 1};\n                if (ost->enc && ost->enc->supported_framerates && !ost->force_fps) {\n                    int idx = av_find_nearest_q_idx(ost->frame_rate, ost->enc->supported_framerates);\n                    ost->frame_rate = ost->enc->supported_framerates[idx];\n                }\n            }\n            if (!ost->filter &&\n                (codec->codec_type == AVMEDIA_TYPE_VIDEO ||\n                 codec->codec_type == AVMEDIA_TYPE_AUDIO)) {\n                    FilterGraph *fg;\n                    fg = init_simple_filtergraph(ist, ost);\n                    if (configure_simple_filtergraph(fg)) {\n                        av_log(NULL, AV_LOG_FATAL, "Error opening filters!\\n");\n                        exit(1);\n                    }\n            }\n            switch (codec->codec_type) {\n            case AVMEDIA_TYPE_AUDIO:\n                codec->sample_fmt     = ost->filter->filter->inputs[0]->format;\n                codec->sample_rate    = ost->filter->filter->inputs[0]->sample_rate;\n                codec->channel_layout = ost->filter->filter->inputs[0]->channel_layout;\n                codec->channels       = av_get_channel_layout_nb_channels(codec->channel_layout);\n                codec->time_base      = (AVRational){ 1, codec->sample_rate };\n                break;\n            case AVMEDIA_TYPE_VIDEO:\n                codec->time_base = ost->filter->filter->inputs[0]->time_base;\n                codec->width  = ost->filter->filter->inputs[0]->w;\n                codec->height = ost->filter->filter->inputs[0]->h;\n                codec->sample_aspect_ratio = ost->st->sample_aspect_ratio =\n                    ost->frame_aspect_ratio ?\n                    av_d2q(ost->frame_aspect_ratio * codec->height/codec->width, 255) :\n                    ost->filter->filter->inputs[0]->sample_aspect_ratio;\n                codec->pix_fmt = ost->filter->filter->inputs[0]->format;\n                if (codec->width   != icodec->width  ||\n                    codec->height  != icodec->height ||\n                    codec->pix_fmt != icodec->pix_fmt) {\n                    codec->bits_per_raw_sample = 0;\n                }\n                break;\n            case AVMEDIA_TYPE_SUBTITLE:\n                codec->time_base = (AVRational){1, 1000};\n                break;\n            default:\n                abort();\n                break;\n            }\n            if ((codec->flags & (CODEC_FLAG_PASS1 | CODEC_FLAG_PASS2))) {\n                char logfilename[1024];\n                FILE *f;\n                snprintf(logfilename, sizeof(logfilename), "%s-%d.log",\n                         pass_logfilename_prefix ? pass_logfilename_prefix : DEFAULT_PASS_LOGFILENAME_PREFIX,\n                         i);\n                if (!strcmp(ost->enc->name, "libx264")) {\n                    av_dict_set(&ost->opts, "stats", logfilename, AV_DICT_DONT_OVERWRITE);\n                } else {\n                    if (codec->flags & CODEC_FLAG_PASS1) {\n                        f = fopen(logfilename, "wb");\n                        if (!f) {\n                            av_log(NULL, AV_LOG_FATAL, "Cannot write log file \'%s\' for pass-1 encoding: %s\\n",\n                                   logfilename, strerror(errno));\n                            exit_program(1);\n                        }\n                        ost->logfile = f;\n                    } else {\n                        char  *logbuffer;\n                        size_t logbuffer_size;\n                        if (cmdutils_read_file(logfilename, &logbuffer, &logbuffer_size) < 0) {\n                            av_log(NULL, AV_LOG_FATAL, "Error reading log file \'%s\' for pass-2 encoding\\n",\n                                   logfilename);\n                            exit_program(1);\n                        }\n                        codec->stats_in = logbuffer;\n                    }\n                }\n            }\n        }\n    }\n    for (i = 0; i < nb_output_streams; i++) {\n        ost = output_streams[i];\n        if (ost->encoding_needed) {\n            AVCodec      *codec = ost->enc;\n            AVCodecContext *dec = NULL;\n            if ((ist = get_input_stream(ost)))\n                dec = ist->st->codec;\n            if (dec && dec->subtitle_header) {\n                ost->st->codec->subtitle_header = av_malloc(dec->subtitle_header_size);\n                if (!ost->st->codec->subtitle_header) {\n                    ret = AVERROR(ENOMEM);\n                    goto dump_format;\n                }\n                memcpy(ost->st->codec->subtitle_header, dec->subtitle_header, dec->subtitle_header_size);\n                ost->st->codec->subtitle_header_size = dec->subtitle_header_size;\n            }\n            if (!av_dict_get(ost->opts, "threads", NULL, 0))\n                av_dict_set(&ost->opts, "threads", "auto", 0);\n            if (avcodec_open2(ost->st->codec, codec, &ost->opts) < 0) {\n                snprintf(error, sizeof(error), "Error while opening encoder for output stream #%d:%d - maybe incorrect parameters such as bit_rate, rate, width or height",\n                        ost->file_index, ost->index);\n                ret = AVERROR(EINVAL);\n                goto dump_format;\n            }\n            assert_codec_experimental(ost->st->codec, 1);\n            assert_avoptions(ost->opts);\n            if (ost->st->codec->bit_rate && ost->st->codec->bit_rate < 1000)\n                av_log(NULL, AV_LOG_WARNING, "The bitrate parameter is set too low."\n                                             "It takes bits/s as argument, not kbits/s\\n");\n            extra_size += ost->st->codec->extradata_size;\n            if (ost->st->codec->me_threshold)\n                input_streams[ost->source_index]->st->codec->debug |= FF_DEBUG_MV;\n        }\n    }\n    for (i = 0; i < nb_input_streams; i++)\n        if ((ret = init_input_stream(i, error, sizeof(error))) < 0)\n            goto dump_format;\n    for (i = 0; i < nb_input_files; i++) {\n        InputFile *ifile = input_files[i];\n        for (j = 0; j < ifile->ctx->nb_programs; j++) {\n            AVProgram *p = ifile->ctx->programs[j];\n            int discard  = AVDISCARD_ALL;\n            for (k = 0; k < p->nb_stream_indexes; k++)\n                if (!input_streams[ifile->ist_index + p->stream_index[k]]->discard) {\n                    discard = AVDISCARD_DEFAULT;\n                    break;\n                }\n            p->discard = discard;\n        }\n    }\n    for (i = 0; i < nb_output_files; i++) {\n        oc = output_files[i]->ctx;\n        oc->interrupt_callback = int_cb;\n        if ((ret = avformat_write_header(oc, &output_files[i]->opts)) < 0) {\n            char errbuf[128];\n            const char *errbuf_ptr = errbuf;\n            if (av_strerror(ret, errbuf, sizeof(errbuf)) < 0)\n                errbuf_ptr = strerror(AVUNERROR(ret));\n            snprintf(error, sizeof(error), "Could not write header for output file #%d (incorrect codec parameters ?): %s", i, errbuf_ptr);\n            ret = AVERROR(EINVAL);\n            goto dump_format;\n        }\n        assert_avoptions(output_files[i]->opts);\n        if (strcmp(oc->oformat->name, "rtp")) {\n            want_sdp = 0;\n        }\n    }\n dump_format:\n    for (i = 0; i < nb_output_files; i++) {\n        av_dump_format(output_files[i]->ctx, i, output_files[i]->ctx->filename, 1);\n    }\n    av_log(NULL, AV_LOG_INFO, "Stream mapping:\\n");\n    for (i = 0; i < nb_input_streams; i++) {\n        ist = input_streams[i];\n        for (j = 0; j < ist->nb_filters; j++) {\n            AVFilterLink *link = ist->filters[j]->filter->outputs[0];\n            if (ist->filters[j]->graph->graph_desc) {\n                av_log(NULL, AV_LOG_INFO, "  Stream #%d:%d (%s) -> %s",\n                       ist->file_index, ist->st->index, ist->dec ? ist->dec->name : "?",\n                       link->dst->filter->name);\n                if (link->dst->input_count > 1)\n                    av_log(NULL, AV_LOG_INFO, ":%s", link->dstpad->name);\n                if (nb_filtergraphs > 1)\n                    av_log(NULL, AV_LOG_INFO, " (graph %d)", ist->filters[j]->graph->index);\n                av_log(NULL, AV_LOG_INFO, "\\n");\n            }\n        }\n    }\n    for (i = 0; i < nb_output_streams; i++) {\n        ost = output_streams[i];\n        if (ost->attachment_filename) {\n            av_log(NULL, AV_LOG_INFO, "  File %s -> Stream #%d:%d\\n",\n                   ost->attachment_filename, ost->file_index, ost->index);\n            continue;\n        }\n        if (ost->filter && ost->filter->graph->graph_desc) {\n            AVFilterLink *link = ost->filter->filter->inputs[0];\n            av_log(NULL, AV_LOG_INFO, "  %s", link->src->filter->name);\n            if (link->src->output_count > 1)\n                av_log(NULL, AV_LOG_INFO, ":%s", link->srcpad->name);\n            if (nb_filtergraphs > 1)\n                av_log(NULL, AV_LOG_INFO, " (graph %d)", ost->filter->graph->index);\n            av_log(NULL, AV_LOG_INFO, " -> Stream #%d:%d (%s)\\n", ost->file_index,\n                   ost->index, ost->enc ? ost->enc->name : "?");\n            continue;\n        }\n        av_log(NULL, AV_LOG_INFO, "  Stream #%d:%d -> #%d:%d",\n               input_streams[ost->source_index]->file_index,\n               input_streams[ost->source_index]->st->index,\n               ost->file_index,\n               ost->index);\n        if (ost->sync_ist != input_streams[ost->source_index])\n            av_log(NULL, AV_LOG_INFO, " [sync #%d:%d]",\n                   ost->sync_ist->file_index,\n                   ost->sync_ist->st->index);\n        if (ost->stream_copy)\n            av_log(NULL, AV_LOG_INFO, " (copy)");\n        else\n            av_log(NULL, AV_LOG_INFO, " (%s -> %s)", input_streams[ost->source_index]->dec ?\n                   input_streams[ost->source_index]->dec->name : "?",\n                   ost->enc ? ost->enc->name : "?");\n        av_log(NULL, AV_LOG_INFO, "\\n");\n    }\n    if (ret) {\n        av_log(NULL, AV_LOG_ERROR, "%s\\n", error);\n        return ret;\n    }\n    if (want_sdp) {\n        print_sdp();\n    }\n    return 0;\n}', 'static void print_sdp(void)\n{\n    char sdp[2048];\n    int i;\n    AVFormatContext **avc = av_malloc(sizeof(*avc) * nb_output_files);\n    if (!avc)\n        exit_program(1);\n    for (i = 0; i < nb_output_files; i++)\n        avc[i] = output_files[i]->ctx;\n    av_sdp_create(avc, nb_output_files, sdp, sizeof(sdp));\n    printf("SDP:\\n%s\\n", sdp);\n    fflush(stdout);\n    av_freep(&avc);\n}', 'int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size)\n{\n    AVDictionaryEntry *title = av_dict_get(ac[0]->metadata, "title", NULL, 0);\n    struct sdp_session_level s = { 0 };\n    int i, j, port, ttl, is_multicast;\n    char dst[32], dst_type[5];\n    memset(buf, 0, size);\n    s.user = "-";\n    s.src_addr = "127.0.0.1";\n    s.src_type = "IP4";\n    s.name = title ? title->value : "No Name";\n    port = 0;\n    ttl = 0;\n    if (n_files == 1) {\n        port = sdp_get_address(dst, sizeof(dst), &ttl, ac[0]->filename);\n        is_multicast = resolve_destination(dst, sizeof(dst), dst_type,\n                                           sizeof(dst_type));\n        if (!is_multicast)\n            ttl = 0;\n        if (dst[0]) {\n            s.dst_addr = dst;\n            s.dst_type = dst_type;\n            s.ttl = ttl;\n            if (!strcmp(dst_type, "IP6")) {\n                s.src_addr = "::1";\n                s.src_type = "IP6";\n            }\n        }\n    }\n    sdp_write_header(buf, size, &s);\n    dst[0] = 0;\n    for (i = 0; i < n_files; i++) {\n        if (n_files != 1) {\n            port = sdp_get_address(dst, sizeof(dst), &ttl, ac[i]->filename);\n            is_multicast = resolve_destination(dst, sizeof(dst), dst_type,\n                                               sizeof(dst_type));\n            if (!is_multicast)\n                ttl = 0;\n        }\n        for (j = 0; j < ac[i]->nb_streams; j++) {\n            ff_sdp_write_media(buf, size,\n                                  ac[i]->streams[j]->codec, dst[0] ? dst : NULL,\n                                  dst_type, (port > 0) ? port + j * 2 : 0, ttl,\n                                  ac[i]);\n            if (port <= 0) {\n                av_strlcatf(buf, size,\n                                   "a=control:streamid=%d\\r\\n", i + j);\n            }\n        }\n    }\n    return 0;\n}', 'static void sdp_write_header(char *buff, int size, struct sdp_session_level *s)\n{\n    av_strlcatf(buff, size, "v=%d\\r\\n"\n                            "o=- %d %d IN %s %s\\r\\n"\n                            "s=%s\\r\\n",\n                            s->sdp_version,\n                            s->id, s->version, s->src_type, s->src_addr,\n                            s->name);\n    sdp_write_address(buff, size, s->dst_addr, s->dst_type, s->ttl);\n    av_strlcatf(buff, size, "t=%d %d\\r\\n"\n                            "a=tool:libavformat " AV_STRINGIFY(LIBAVFORMAT_VERSION) "\\r\\n",\n                            s->start_time, s->end_time);\n}', 'size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...)\n{\n    int len = strlen(dst);\n    va_list vl;\n    va_start(vl, fmt);\n    len += vsnprintf(dst + len, size > len ? size - len : 0, fmt, vl);\n    va_end(vl);\n    return len;\n}']