avconv.c:2548: error: Integer Overflow L2
  ([1, 2147483616] + 32):signed32 by call to `process_input_packet`.

avconv.c:2543:9: Assignment
2541.                 exit_program(1);
2542.         }
2543.         ifile->eof_reached = 1;
              ^
2544. 
2545.         for (i = 0; i < ifile->nb_streams; i++) {

avconv.c:2548:17: Call
2546.             ist = input_streams[ifile->ist_index + i];
2547.             if (ist->decoding_needed)
2548.                 process_input_packet(ist, NULL, 0);
                      ^
2549. 
2550.             /* mark all outputs that don't go through lavfi as finished */

avconv.c:1373:1: Parameter `ist->decoded_frame->nb_samples`
  1371. 
  1372. /* pkt = NULL means EOF (needed to flush decoder buffers) */
  1373. static void process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eof)
        ^
  1374. {
  1375.     int i;

avconv.c:1404:19: Call
  1402.         switch (ist->dec_ctx->codec_type) {
  1403.         case AVMEDIA_TYPE_AUDIO:
  1404.             ret = decode_audio    (ist, repeating ? NULL : &avpkt, &got_output);
                          ^
  1405.             break;
  1406.         case AVMEDIA_TYPE_VIDEO:

avconv.c:1164:1: Parameter `ist->decoded_frame->nb_samples`
    1162. }
    1163. 
    1164. static int decode_audio(InputStream *ist, AVPacket *pkt, int *got_output)
          ^
    1165. {
    1166.     AVFrame *decoded_frame, *f;

avconv.c:1240:19: Call
    1238.         if (i < ist->nb_filters - 1) {
    1239.             f = ist->filter_frame;
    1240.             err = av_frame_ref(f, decoded_frame);
                            ^
    1241.             if (err < 0)
    1242.                 break;

libavutil/frame.c:199:1: Parameter `src->nb_samples`
      197. }
      198. 
      199. int av_frame_ref(AVFrame *dst, const AVFrame *src)
           ^
      200. {
      201.     int i, ret = 0;

libavutil/frame.c:207:5: Assignment
      205.     dst->height         = src->height;
      206.     dst->channel_layout = src->channel_layout;
      207.     dst->nb_samples     = src->nb_samples;
               ^
      208. 
      209.     ret = av_frame_copy_props(dst, src);

libavutil/frame.c:215:15: Call
      213.     /* duplicate the frame data if it's not refcounted */
      214.     if (!src->buf[0]) {
      215.         ret = av_frame_get_buffer(dst, 32);
                         ^
      216.         if (ret < 0)
      217.             return ret;

libavutil/frame.c:186:1: Parameter `frame->nb_samples`
        184. }
        185. 
        186. int av_frame_get_buffer(AVFrame *frame, int align)
             ^
        187. {
        188.     if (frame->format < 0)

libavutil/frame.c:194:16: Call
        192.         return get_video_buffer(frame, align);
        193.     else if (frame->nb_samples > 0 && frame->channel_layout)
        194.         return get_audio_buffer(frame, align);
                            ^
        195. 
        196.     return AVERROR(EINVAL);

libavutil/frame.c:137:1: Parameter `frame->nb_samples`
          135. }
          136. 
          137. static int get_audio_buffer(AVFrame *frame, int align)
               ^
          138. {
          139.     int channels = av_get_channel_layout_nb_channels(frame->channel_layout);

libavutil/frame.c:145:15: Call
          143. 
          144.     if (!frame->linesize[0]) {
          145.         ret = av_samples_get_buffer_size(&frame->linesize[0], channels,
                             ^
          146.                                          frame->nb_samples, frame->format,
          147.                                          align);

libavutil/samplefmt.c:108:1: <LHS trace>
106. }
107. 
108. int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples,
     ^
109.                                enum AVSampleFormat sample_fmt, int align)
110. {

libavutil/samplefmt.c:108:1: Parameter `nb_samples`
            106. }
            107. 
            108. int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples,
                 ^
            109.                                enum AVSampleFormat sample_fmt, int align)
            110. {

libavutil/samplefmt.c:124:9: Binary operation: ([1, 2147483616] + 32):signed32 by call to `process_input_packet` 
            122.             return AVERROR(EINVAL);
            123.         align = 1;
            124.         nb_samples = FFALIGN(nb_samples, 32);
                         ^
            125.     }
            126. 

int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples,
                               enum AVSampleFormat sample_fmt, int align)
{
    int line_size;
    int sample_size = av_get_bytes_per_sample(sample_fmt);
    int planar      = av_sample_fmt_is_planar(sample_fmt);
    if (!sample_size || nb_samples <= 0 || nb_channels <= 0)
        return AVERROR(EINVAL);
    if (!align) {
        if (nb_samples > INT_MAX - 31)
            return AVERROR(EINVAL);
        align = 1;
        nb_samples = FFALIGN(nb_samples, 32);
    }
    if (nb_channels > INT_MAX / align ||
        (int64_t)nb_channels * nb_samples > (INT_MAX - (align * nb_channels)) / sample_size)
        return AVERROR(EINVAL);
    line_size = planar ? FFALIGN(nb_samples * sample_size,               align) :
                         FFALIGN(nb_samples * sample_size * nb_channels, align);
    if (linesize)
        *linesize = line_size;
    return planar ? line_size * nb_channels : line_size;
}
['static int process_input(void)\n{\n    InputFile *ifile;\n    AVFormatContext *is;\n    InputStream *ist;\n    AVPacket pkt;\n    int ret, i, j;\n    int64_t duration;\n    ifile = select_input_file();\n    if (!ifile) {\n        if (got_eagain()) {\n            reset_eagain();\n            av_usleep(10000);\n            return AVERROR(EAGAIN);\n        }\n        av_log(NULL, AV_LOG_VERBOSE, "No more inputs to read from.\\n");\n        return AVERROR_EOF;\n    }\n    is  = ifile->ctx;\n    ret = get_input_packet(ifile, &pkt);\n    if (ret == AVERROR(EAGAIN)) {\n        ifile->eagain = 1;\n        return ret;\n    }\n    if (ret < 0 && ifile->loop) {\n        if ((ret = seek_to_start(ifile, is)) < 0)\n            return ret;\n        ret = get_input_packet(ifile, &pkt);\n    }\n    if (ret < 0) {\n        if (ret != AVERROR_EOF) {\n            print_error(is->filename, ret);\n            if (exit_on_error)\n                exit_program(1);\n        }\n        ifile->eof_reached = 1;\n        for (i = 0; i < ifile->nb_streams; i++) {\n            ist = input_streams[ifile->ist_index + i];\n            if (ist->decoding_needed)\n                process_input_packet(ist, NULL, 0);\n            for (j = 0; j < nb_output_streams; j++) {\n                OutputStream *ost = output_streams[j];\n                if (ost->source_index == ifile->ist_index + i &&\n                    (ost->stream_copy || ost->enc->type == AVMEDIA_TYPE_SUBTITLE))\n                    finish_output_stream(ost);\n            }\n        }\n        return AVERROR(EAGAIN);\n    }\n    reset_eagain();\n    if (do_pkt_dump) {\n        av_pkt_dump_log2(NULL, AV_LOG_DEBUG, &pkt, do_hex_dump,\n                         is->streams[pkt.stream_index]);\n    }\n    if (pkt.stream_index >= ifile->nb_streams)\n        goto discard_packet;\n    ist = input_streams[ifile->ist_index + pkt.stream_index];\n    ist->data_size += pkt.size;\n    ist->nb_packets++;\n    if (ist->discard)\n        goto discard_packet;\n    if (ist->nb_packets == 1)\n        for (i = 0; i < ist->st->nb_side_data; i++) {\n            AVPacketSideData *src_sd = &ist->st->side_data[i];\n            uint8_t *dst_data;\n            if (av_packet_get_side_data(&pkt, src_sd->type, NULL))\n                continue;\n            if (ist->autorotate && src_sd->type == AV_PKT_DATA_DISPLAYMATRIX)\n                continue;\n            dst_data = av_packet_new_side_data(&pkt, src_sd->type, src_sd->size);\n            if (!dst_data)\n                exit_program(1);\n            memcpy(dst_data, src_sd->data, src_sd->size);\n        }\n    if (pkt.dts != AV_NOPTS_VALUE)\n        pkt.dts += av_rescale_q(ifile->ts_offset, AV_TIME_BASE_Q, ist->st->time_base);\n    if (pkt.pts != AV_NOPTS_VALUE)\n        pkt.pts += av_rescale_q(ifile->ts_offset, AV_TIME_BASE_Q, ist->st->time_base);\n    if (pkt.pts != AV_NOPTS_VALUE)\n        pkt.pts *= ist->ts_scale;\n    if (pkt.dts != AV_NOPTS_VALUE)\n        pkt.dts *= ist->ts_scale;\n    if ((ist->dec_ctx->codec_type == AVMEDIA_TYPE_VIDEO ||\n         ist->dec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) &&\n        pkt.dts != AV_NOPTS_VALUE && ist->next_dts != AV_NOPTS_VALUE &&\n        (is->iformat->flags & AVFMT_TS_DISCONT)) {\n        int64_t pkt_dts = av_rescale_q(pkt.dts, ist->st->time_base, AV_TIME_BASE_Q);\n        int64_t delta   = pkt_dts - ist->next_dts;\n        if ((FFABS(delta) > 1LL * dts_delta_threshold * AV_TIME_BASE || pkt_dts + 1 < ist->last_dts) && !copy_ts) {\n            ifile->ts_offset -= delta;\n            av_log(NULL, AV_LOG_DEBUG,\n                   "timestamp discontinuity %"PRId64", new offset= %"PRId64"\\n",\n                   delta, ifile->ts_offset);\n            pkt.dts -= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base);\n            if (pkt.pts != AV_NOPTS_VALUE)\n                pkt.pts -= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base);\n        }\n    }\n    duration = av_rescale_q(ifile->duration, ifile->time_base, ist->st->time_base);\n    if (pkt.pts != AV_NOPTS_VALUE) {\n        pkt.pts += duration;\n        ist->max_pts = FFMAX(pkt.pts, ist->max_pts);\n        ist->min_pts = FFMIN(pkt.pts, ist->min_pts);\n    }\n    if (pkt.dts != AV_NOPTS_VALUE)\n        pkt.dts += duration;\n    process_input_packet(ist, &pkt, 0);\ndiscard_packet:\n    av_packet_unref(&pkt);\n    return 0;\n}', 'static void process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eof)\n{\n    int i;\n    int repeating = 0;\n    AVPacket avpkt;\n    if (ist->next_dts == AV_NOPTS_VALUE)\n        ist->next_dts = ist->last_dts;\n    if (!pkt) {\n        av_init_packet(&avpkt);\n        avpkt.data = NULL;\n        avpkt.size = 0;\n    } else {\n        avpkt = *pkt;\n    }\n    if (pkt && pkt->dts != AV_NOPTS_VALUE)\n        ist->next_dts = ist->last_dts = av_rescale_q(pkt->dts, ist->st->time_base, AV_TIME_BASE_Q);\n    while (ist->decoding_needed && (!pkt || avpkt.size > 0)) {\n        int ret = 0;\n        int got_output = 0;\n        if (!repeating)\n            ist->last_dts = ist->next_dts;\n        switch (ist->dec_ctx->codec_type) {\n        case AVMEDIA_TYPE_AUDIO:\n            ret = decode_audio    (ist, repeating ? NULL : &avpkt, &got_output);\n            break;\n        case AVMEDIA_TYPE_VIDEO:\n            ret = decode_video    (ist, repeating ? NULL : &avpkt, &got_output);\n            if (repeating && !got_output)\n                ;\n            else if (pkt && pkt->duration)\n                ist->next_dts += av_rescale_q(pkt->duration, ist->st->time_base, AV_TIME_BASE_Q);\n            else if (ist->st->avg_frame_rate.num)\n                ist->next_dts += av_rescale_q(1, av_inv_q(ist->st->avg_frame_rate),\n                                              AV_TIME_BASE_Q);\n            else if (ist->dec_ctx->framerate.num != 0) {\n                int ticks      = ist->st->parser ? ist->st->parser->repeat_pict + 1 :\n                                                   ist->dec_ctx->ticks_per_frame;\n                ist->next_dts += av_rescale_q(ticks, ist->dec_ctx->framerate, AV_TIME_BASE_Q);\n            }\n            break;\n        case AVMEDIA_TYPE_SUBTITLE:\n            if (repeating)\n                break;\n            ret = transcode_subtitles(ist, &avpkt, &got_output);\n            break;\n        default:\n            return;\n        }\n        if (ret < 0) {\n            av_log(NULL, AV_LOG_ERROR, "Error while decoding stream #%d:%d\\n",\n                   ist->file_index, ist->st->index);\n            if (exit_on_error)\n                exit_program(1);\n            break;\n        }\n        if (!got_output)\n            break;\n        repeating = 1;\n    }\n    if (!pkt && ist->decoding_needed && !no_eof) {\n        int ret = send_filter_eof(ist);\n        if (ret < 0) {\n            av_log(NULL, AV_LOG_FATAL, "Error marking filters as finished\\n");\n            exit_program(1);\n        }\n    }\n    if (!ist->decoding_needed) {\n        ist->last_dts = ist->next_dts;\n        switch (ist->dec_ctx->codec_type) {\n        case AVMEDIA_TYPE_AUDIO:\n            ist->next_dts += ((int64_t)AV_TIME_BASE * ist->dec_ctx->frame_size) /\n                             ist->dec_ctx->sample_rate;\n            break;\n        case AVMEDIA_TYPE_VIDEO:\n            if (ist->dec_ctx->framerate.num != 0) {\n                int ticks = ist->st->parser ? ist->st->parser->repeat_pict + 1 : ist->dec_ctx->ticks_per_frame;\n                ist->next_dts += ((int64_t)AV_TIME_BASE *\n                                  ist->dec_ctx->framerate.den * ticks) /\n                                  ist->dec_ctx->framerate.num;\n            }\n            break;\n        }\n    }\n    for (i = 0; pkt && i < nb_output_streams; i++) {\n        OutputStream *ost = output_streams[i];\n        if (!check_output_constraints(ist, ost) || ost->encoding_needed)\n            continue;\n        do_streamcopy(ist, ost, pkt);\n    }\n    return;\n}', 'static int decode_audio(InputStream *ist, AVPacket *pkt, int *got_output)\n{\n    AVFrame *decoded_frame, *f;\n    AVCodecContext *avctx = ist->dec_ctx;\n    int i, ret, err = 0, resample_changed;\n    if (!ist->decoded_frame && !(ist->decoded_frame = av_frame_alloc()))\n        return AVERROR(ENOMEM);\n    if (!ist->filter_frame && !(ist->filter_frame = av_frame_alloc()))\n        return AVERROR(ENOMEM);\n    decoded_frame = ist->decoded_frame;\n    ret = decode(avctx, decoded_frame, got_output, pkt);\n    if (!*got_output || ret < 0)\n        return ret;\n    ist->samples_decoded += decoded_frame->nb_samples;\n    ist->frames_decoded++;\n    if (decoded_frame->pts != AV_NOPTS_VALUE)\n        ist->next_dts = decoded_frame->pts;\n    else if (pkt && pkt->pts != AV_NOPTS_VALUE) {\n        decoded_frame->pts = pkt->pts;\n    }\n    resample_changed = ist->resample_sample_fmt     != decoded_frame->format         ||\n                       ist->resample_channels       != avctx->channels               ||\n                       ist->resample_channel_layout != decoded_frame->channel_layout ||\n                       ist->resample_sample_rate    != decoded_frame->sample_rate;\n    if (resample_changed) {\n        char layout1[64], layout2[64];\n        if (!guess_input_channel_layout(ist)) {\n            av_log(NULL, AV_LOG_FATAL, "Unable to find default channel "\n                   "layout for Input Stream #%d.%d\\n", ist->file_index,\n                   ist->st->index);\n            exit_program(1);\n        }\n        decoded_frame->channel_layout = avctx->channel_layout;\n        av_get_channel_layout_string(layout1, sizeof(layout1), ist->resample_channels,\n                                     ist->resample_channel_layout);\n        av_get_channel_layout_string(layout2, sizeof(layout2), avctx->channels,\n                                     decoded_frame->channel_layout);\n        av_log(NULL, AV_LOG_INFO,\n               "Input stream #%d:%d frame changed from rate:%d fmt:%s ch:%d chl:%s to rate:%d fmt:%s ch:%d chl:%s\\n",\n               ist->file_index, ist->st->index,\n               ist->resample_sample_rate,  av_get_sample_fmt_name(ist->resample_sample_fmt),\n               ist->resample_channels, layout1,\n               decoded_frame->sample_rate, av_get_sample_fmt_name(decoded_frame->format),\n               avctx->channels, layout2);\n        ist->resample_sample_fmt     = decoded_frame->format;\n        ist->resample_sample_rate    = decoded_frame->sample_rate;\n        ist->resample_channel_layout = decoded_frame->channel_layout;\n        ist->resample_channels       = avctx->channels;\n        for (i = 0; i < nb_filtergraphs; i++)\n            if (ist_in_filtergraph(filtergraphs[i], ist) &&\n                configure_filtergraph(filtergraphs[i]) < 0) {\n                av_log(NULL, AV_LOG_FATAL, "Error reinitializing filters!\\n");\n                exit_program(1);\n            }\n    }\n    if (decoded_frame->pts != AV_NOPTS_VALUE)\n        decoded_frame->pts = av_rescale_q(decoded_frame->pts,\n                                          ist->st->time_base,\n                                          (AVRational){1, avctx->sample_rate});\n    ist->nb_samples = decoded_frame->nb_samples;\n    for (i = 0; i < ist->nb_filters; i++) {\n        if (i < ist->nb_filters - 1) {\n            f = ist->filter_frame;\n            err = av_frame_ref(f, decoded_frame);\n            if (err < 0)\n                break;\n        } else\n            f = decoded_frame;\n        err = av_buffersrc_add_frame(ist->filters[i]->filter, f);\n        if (err < 0)\n            break;\n    }\n    av_frame_unref(ist->filter_frame);\n    av_frame_unref(decoded_frame);\n    return err < 0 ? err : ret;\n}', 'int av_frame_ref(AVFrame *dst, const AVFrame *src)\n{\n    int i, ret = 0;\n    dst->format         = src->format;\n    dst->width          = src->width;\n    dst->height         = src->height;\n    dst->channel_layout = src->channel_layout;\n    dst->nb_samples     = src->nb_samples;\n    ret = av_frame_copy_props(dst, src);\n    if (ret < 0)\n        return ret;\n    if (!src->buf[0]) {\n        ret = av_frame_get_buffer(dst, 32);\n        if (ret < 0)\n            return ret;\n        ret = av_frame_copy(dst, src);\n        if (ret < 0)\n            av_frame_unref(dst);\n        return ret;\n    }\n    for (i = 0; i < FF_ARRAY_ELEMS(src->buf) && src->buf[i]; i++) {\n        dst->buf[i] = av_buffer_ref(src->buf[i]);\n        if (!dst->buf[i]) {\n            ret = AVERROR(ENOMEM);\n            goto fail;\n        }\n    }\n    if (src->extended_buf) {\n        dst->extended_buf = av_mallocz(sizeof(*dst->extended_buf) *\n                                       src->nb_extended_buf);\n        if (!dst->extended_buf) {\n            ret = AVERROR(ENOMEM);\n            goto fail;\n        }\n        dst->nb_extended_buf = src->nb_extended_buf;\n        for (i = 0; i < src->nb_extended_buf; i++) {\n            dst->extended_buf[i] = av_buffer_ref(src->extended_buf[i]);\n            if (!dst->extended_buf[i]) {\n                ret = AVERROR(ENOMEM);\n                goto fail;\n            }\n        }\n    }\n    if (src->hw_frames_ctx) {\n        dst->hw_frames_ctx = av_buffer_ref(src->hw_frames_ctx);\n        if (!dst->hw_frames_ctx) {\n            ret = AVERROR(ENOMEM);\n            goto fail;\n        }\n    }\n    if (src->extended_data != src->data) {\n        int ch = av_get_channel_layout_nb_channels(src->channel_layout);\n        if (!ch) {\n            ret = AVERROR(EINVAL);\n            goto fail;\n        }\n        dst->extended_data = av_malloc(sizeof(*dst->extended_data) * ch);\n        if (!dst->extended_data) {\n            ret = AVERROR(ENOMEM);\n            goto fail;\n        }\n        memcpy(dst->extended_data, src->extended_data, sizeof(*src->extended_data) * ch);\n    } else\n        dst->extended_data = dst->data;\n    memcpy(dst->data,     src->data,     sizeof(src->data));\n    memcpy(dst->linesize, src->linesize, sizeof(src->linesize));\n    return 0;\nfail:\n    av_frame_unref(dst);\n    return ret;\n}', 'int av_frame_get_buffer(AVFrame *frame, int align)\n{\n    if (frame->format < 0)\n        return AVERROR(EINVAL);\n    if (frame->width > 0 && frame->height > 0)\n        return get_video_buffer(frame, align);\n    else if (frame->nb_samples > 0 && frame->channel_layout)\n        return get_audio_buffer(frame, align);\n    return AVERROR(EINVAL);\n}', 'static int get_audio_buffer(AVFrame *frame, int align)\n{\n    int channels = av_get_channel_layout_nb_channels(frame->channel_layout);\n    int planar   = av_sample_fmt_is_planar(frame->format);\n    int planes   = planar ? channels : 1;\n    int ret, i;\n    if (!frame->linesize[0]) {\n        ret = av_samples_get_buffer_size(&frame->linesize[0], channels,\n                                         frame->nb_samples, frame->format,\n                                         align);\n        if (ret < 0)\n            return ret;\n    }\n    if (planes > AV_NUM_DATA_POINTERS) {\n        frame->extended_data = av_mallocz(planes *\n                                          sizeof(*frame->extended_data));\n        frame->extended_buf  = av_mallocz((planes - AV_NUM_DATA_POINTERS) *\n                                          sizeof(*frame->extended_buf));\n        if (!frame->extended_data || !frame->extended_buf) {\n            av_freep(&frame->extended_data);\n            av_freep(&frame->extended_buf);\n            return AVERROR(ENOMEM);\n        }\n        frame->nb_extended_buf = planes - AV_NUM_DATA_POINTERS;\n    } else\n        frame->extended_data = frame->data;\n    for (i = 0; i < FFMIN(planes, AV_NUM_DATA_POINTERS); i++) {\n        frame->buf[i] = av_buffer_alloc(frame->linesize[0]);\n        if (!frame->buf[i]) {\n            av_frame_unref(frame);\n            return AVERROR(ENOMEM);\n        }\n        frame->extended_data[i] = frame->data[i] = frame->buf[i]->data;\n    }\n    for (i = 0; i < planes - AV_NUM_DATA_POINTERS; i++) {\n        frame->extended_buf[i] = av_buffer_alloc(frame->linesize[0]);\n        if (!frame->extended_buf[i]) {\n            av_frame_unref(frame);\n            return AVERROR(ENOMEM);\n        }\n        frame->extended_data[i + AV_NUM_DATA_POINTERS] = frame->extended_buf[i]->data;\n    }\n    return 0;\n}', 'int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples,\n                               enum AVSampleFormat sample_fmt, int align)\n{\n    int line_size;\n    int sample_size = av_get_bytes_per_sample(sample_fmt);\n    int planar      = av_sample_fmt_is_planar(sample_fmt);\n    if (!sample_size || nb_samples <= 0 || nb_channels <= 0)\n        return AVERROR(EINVAL);\n    if (!align) {\n        if (nb_samples > INT_MAX - 31)\n            return AVERROR(EINVAL);\n        align = 1;\n        nb_samples = FFALIGN(nb_samples, 32);\n    }\n    if (nb_channels > INT_MAX / align ||\n        (int64_t)nb_channels * nb_samples > (INT_MAX - (align * nb_channels)) / sample_size)\n        return AVERROR(EINVAL);\n    line_size = planar ? FFALIGN(nb_samples * sample_size,               align) :\n                         FFALIGN(nb_samples * sample_size * nb_channels, align);\n    if (linesize)\n        *linesize = line_size;\n    return planar ? line_size * nb_channels : line_size;\n}']