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

avconv.c:2503:13: Call
2501.         if (ist->decoding_needed) {
2502.             process_input_packet(ist, NULL, 1);
2503.             avcodec_flush_buffers(avctx);
                  ^
2504.         }
2505. 

libavcodec/utils.c:2294:9: Call
  2292. 
  2293.     if (HAVE_THREADS && avctx->active_thread_type & FF_THREAD_FRAME)
  2294.         ff_thread_flush(avctx);
                ^
  2295.     else if (avctx->codec->flush)
  2296.         avctx->codec->flush(avctx);

libavcodec/pthread_frame.c:697:5: Assignment
    695.     fctx->next_decoding = fctx->next_finished = 0;
    696.     fctx->delaying = 1;
    697.     fctx->prev_thread = NULL;
             ^
    698.     for (i = 0; i < avctx->thread_count; i++) {
    699.         PerThreadContext *p = &fctx->threads[i];

avconv.c:2502:13: Call
2500.         // flush decoders
2501.         if (ist->decoding_needed) {
2502.             process_input_packet(ist, NULL, 1);
                  ^
2503.             avcodec_flush_buffers(avctx);
2504.         }

avconv.c:1478:1: Parameter `ist->decoded_frame->nb_samples`
  1476. 
  1477. /* pkt = NULL means EOF (needed to flush decoder buffers) */
  1478. static void process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eof)
        ^
  1479. {
  1480.     int i;

avconv.c:1510:19: Call
  1508.         switch (ist->dec_ctx->codec_type) {
  1509.         case AVMEDIA_TYPE_AUDIO:
  1510.             ret = decode_audio    (ist, repeating ? NULL : &avpkt, &got_output,
                          ^
  1511.                                    &decode_failed);
  1512.             break;

avconv.c:1329:1: Parameter `ist->decoded_frame->nb_samples`
    1327. }
    1328. 
    1329. static int decode_audio(InputStream *ist, AVPacket *pkt, int *got_output,
          ^
    1330.                         int *decode_failed)
    1331. {

avconv.c:1367:19: Call
    1365.         if (i < ist->nb_filters - 1) {
    1366.             f = ist->filter_frame;
    1367.             err = av_frame_ref(f, decoded_frame);
                            ^
    1368.             if (err < 0)
    1369.                 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 seek_to_start(InputFile *ifile, AVFormatContext *is)\n{\n    InputStream *ist;\n    AVCodecContext *avctx;\n    int i, ret, has_audio = 0;\n    int64_t duration = 0;\n    ret = av_seek_frame(is, -1, is->start_time, 0);\n    if (ret < 0)\n        return ret;\n    for (i = 0; i < ifile->nb_streams; i++) {\n        ist   = input_streams[ifile->ist_index + i];\n        avctx = ist->dec_ctx;\n        if (ist->decoding_needed) {\n            process_input_packet(ist, NULL, 1);\n            avcodec_flush_buffers(avctx);\n        }\n        if (avctx->codec_type == AVMEDIA_TYPE_AUDIO && ist->nb_samples)\n            has_audio = 1;\n    }\n    for (i = 0; i < ifile->nb_streams; i++) {\n        ist   = input_streams[ifile->ist_index + i];\n        avctx = ist->dec_ctx;\n        if (has_audio) {\n            if (avctx->codec_type == AVMEDIA_TYPE_AUDIO && ist->nb_samples) {\n                AVRational sample_rate = {1, avctx->sample_rate};\n                duration = av_rescale_q(ist->nb_samples, sample_rate, ist->st->time_base);\n            } else\n                continue;\n        } else {\n            if (ist->framerate.num) {\n                duration = av_rescale_q(1, ist->framerate, ist->st->time_base);\n            } else if (ist->st->avg_frame_rate.num) {\n                duration = av_rescale_q(1, ist->st->avg_frame_rate, ist->st->time_base);\n            } else duration = 1;\n        }\n        if (!ifile->duration)\n            ifile->time_base = ist->st->time_base;\n        duration += ist->max_pts - ist->min_pts;\n        ifile->time_base = duration_max(duration, &ifile->duration, ist->st->time_base,\n                                        ifile->time_base);\n    }\n    if (ifile->loop > 0)\n        ifile->loop--;\n    return ret;\n}', 'void avcodec_flush_buffers(AVCodecContext *avctx)\n{\n    avctx->internal->draining      = 0;\n    avctx->internal->draining_done = 0;\n    av_frame_unref(avctx->internal->buffer_frame);\n    av_packet_unref(avctx->internal->buffer_pkt);\n    avctx->internal->buffer_pkt_valid = 0;\n    if (HAVE_THREADS && avctx->active_thread_type & FF_THREAD_FRAME)\n        ff_thread_flush(avctx);\n    else if (avctx->codec->flush)\n        avctx->codec->flush(avctx);\n    if (!avctx->refcounted_frames)\n        av_frame_unref(avctx->internal->to_free);\n}', 'void ff_thread_flush(AVCodecContext *avctx)\n{\n    int i;\n    FrameThreadContext *fctx = avctx->internal->thread_ctx;\n    if (!fctx) return;\n    park_frame_worker_threads(fctx, avctx->thread_count);\n    if (fctx->prev_thread) {\n        if (fctx->prev_thread != &fctx->threads[0])\n            update_context_from_thread(fctx->threads[0].avctx, fctx->prev_thread->avctx, 0);\n    }\n    fctx->next_decoding = fctx->next_finished = 0;\n    fctx->delaying = 1;\n    fctx->prev_thread = NULL;\n    for (i = 0; i < avctx->thread_count; i++) {\n        PerThreadContext *p = &fctx->threads[i];\n        p->got_frame = 0;\n        av_frame_unref(p->frame);\n        release_delayed_buffers(p);\n        if (avctx->codec->flush)\n            avctx->codec->flush(p->avctx);\n    }\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        int decode_failed = 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                                   &decode_failed);\n            break;\n        case AVMEDIA_TYPE_VIDEO:\n            ret = decode_video    (ist, repeating ? NULL : &avpkt, &got_output,\n                                   &decode_failed);\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, &decode_failed);\n            break;\n        default:\n            return;\n        }\n        if (ret < 0) {\n            if (decode_failed) {\n                av_log(NULL, AV_LOG_ERROR, "Error while decoding stream #%d:%d\\n",\n                       ist->file_index, ist->st->index);\n            } else {\n                av_log(NULL, AV_LOG_FATAL, "Error while processing the decoded "\n                       "data for stream #%d:%d\\n", ist->file_index, ist->st->index);\n            }\n            if (!decode_failed || 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                        int *decode_failed)\n{\n    AVFrame *decoded_frame, *f;\n    AVCodecContext *avctx = ist->dec_ctx;\n    int i, ret, err = 0;\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 (ret < 0)\n        *decode_failed = 1;\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    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 = ifilter_send_frame(ist->filters[i], 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}']