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

avconv.c:2031:13: Call
2029. #endif
2030. 
2031.             do_video_out(output_files[ost->file_index].ctx, ost, ist, filtered_frame, &frame_size,
                  ^
2032.                          same_quant ? quality : ost->st->codec->global_quality);
2033.             if (vstats_filename && frame_size)

avconv.c:1432:13: Call
  1430.             pkt.flags |= AV_PKT_FLAG_KEY;
  1431. 
  1432.             write_frame(s, &pkt, ost);
                    ^
  1433.         } else {
  1434.             int got_packet;

avconv.c:2038:17: Call
2036.             frame_available = ost->output_video_filter && avfilter_poll_frame(ost->output_video_filter->inputs[0]);
2037.             if (ost->picref)
2038.                 avfilter_unref_buffer(ost->picref);
                      ^
2039.         }
2040. #endif

libavfilter/avfilter.c:73:1: <LHS trace>
71. }
72. 
73. void avfilter_unref_buffer(AVFilterBufferRef *ref)
    ^
74. {
75.     if (!ref)

libavfilter/avfilter.c:73:1: Parameter `ref->buf->refcount`
  71. }
  72. 
  73. void avfilter_unref_buffer(AVFilterBufferRef *ref)
      ^
  74. {
  75.     if (!ref)

libavfilter/avfilter.c:77:11: Binary operation: ([0, +oo] - 1):unsigned32 by call to `avfilter_unref_buffer` 
  75.     if (!ref)
  76.         return;
  77.     if (!(--ref->buf->refcount))
                ^
  78.         ref->buf->free(ref->buf);
  79.     av_free(ref->video);

void avfilter_unref_buffer(AVFilterBufferRef *ref)
{
    if (!ref)
        return;
    if (!(--ref->buf->refcount))
        ref->buf->free(ref->buf);
    av_free(ref->video);
    av_free(ref->audio);
    av_free(ref);
}
['static int transcode_video(InputStream *ist, AVPacket *pkt, int *got_output, int64_t *pkt_pts)\n{\n    AVFrame *decoded_frame, *filtered_frame = NULL;\n    void *buffer_to_free = NULL;\n    int i, ret = 0;\n    float quality;\n#if CONFIG_AVFILTER\n    int frame_available = 1;\n#endif\n    if (!ist->decoded_frame && !(ist->decoded_frame = avcodec_alloc_frame()))\n        return AVERROR(ENOMEM);\n    else\n        avcodec_get_frame_defaults(ist->decoded_frame);\n    decoded_frame = ist->decoded_frame;\n    pkt->pts  = *pkt_pts;\n    pkt->dts  = ist->last_dts;\n    *pkt_pts  = AV_NOPTS_VALUE;\n    ret = avcodec_decode_video2(ist->st->codec,\n                                decoded_frame, got_output, pkt);\n    if (ret < 0)\n        return ret;\n    quality = same_quant ? decoded_frame->quality : 0;\n    if (!*got_output) {\n        return ret;\n    }\n    decoded_frame->pts = guess_correct_pts(&ist->pts_ctx, decoded_frame->pkt_pts,\n                                           decoded_frame->pkt_dts);\n    pkt->size = 0;\n    pre_process_video_frame(ist, (AVPicture *)decoded_frame, &buffer_to_free);\n    rate_emu_sleep(ist);\n    for (i = 0; i < nb_output_streams; i++) {\n        OutputStream *ost = &output_streams[i];\n        int frame_size, resample_changed;\n        if (!check_output_constraints(ist, ost) || !ost->encoding_needed)\n            continue;\n#if CONFIG_AVFILTER\n        resample_changed = ost->resample_width   != decoded_frame->width  ||\n                           ost->resample_height  != decoded_frame->height ||\n                           ost->resample_pix_fmt != decoded_frame->format;\n        if (resample_changed) {\n            av_log(NULL, AV_LOG_INFO,\n                    "Input stream #%d:%d frame changed from size:%dx%d fmt:%s to size:%dx%d fmt:%s\\n",\n                    ist->file_index, ist->st->index,\n                    ost->resample_width,  ost->resample_height,  av_get_pix_fmt_name(ost->resample_pix_fmt),\n                    decoded_frame->width, decoded_frame->height, av_get_pix_fmt_name(decoded_frame->format));\n            avfilter_graph_free(&ost->graph);\n            if (configure_video_filters(ist, ost)) {\n                av_log(NULL, AV_LOG_FATAL, "Error reinitializing filters!\\n");\n                exit_program(1);\n            }\n            ost->resample_width   = decoded_frame->width;\n            ost->resample_height  = decoded_frame->height;\n            ost->resample_pix_fmt = decoded_frame->format;\n        }\n        if (ist->st->sample_aspect_ratio.num)\n            decoded_frame->sample_aspect_ratio = ist->st->sample_aspect_ratio;\n        if (ist->st->codec->codec->capabilities & CODEC_CAP_DR1) {\n            FrameBuffer      *buf = decoded_frame->opaque;\n            AVFilterBufferRef *fb = avfilter_get_video_buffer_ref_from_arrays(\n                                        decoded_frame->data, decoded_frame->linesize,\n                                        AV_PERM_READ | AV_PERM_PRESERVE,\n                                        ist->st->codec->width, ist->st->codec->height,\n                                        ist->st->codec->pix_fmt);\n            avfilter_copy_frame_props(fb, decoded_frame);\n            fb->buf->priv           = buf;\n            fb->buf->free           = filter_release_buffer;\n            buf->refcount++;\n            av_buffersrc_buffer(ost->input_video_filter, fb);\n        } else\n            av_vsrc_buffer_add_frame(ost->input_video_filter, decoded_frame,\n                                     decoded_frame->pts, decoded_frame->sample_aspect_ratio);\n        if (!ist->filtered_frame && !(ist->filtered_frame = avcodec_alloc_frame())) {\n            av_free(buffer_to_free);\n            return AVERROR(ENOMEM);\n        } else\n            avcodec_get_frame_defaults(ist->filtered_frame);\n        filtered_frame = ist->filtered_frame;\n        frame_available = avfilter_poll_frame(ost->output_video_filter->inputs[0]);\n        while (frame_available) {\n            AVRational ist_pts_tb;\n            if (ost->output_video_filter)\n                get_filtered_video_frame(ost->output_video_filter, filtered_frame, &ost->picref, &ist_pts_tb);\n            if (ost->picref)\n                filtered_frame->pts = av_rescale_q(ost->picref->pts, ist_pts_tb, AV_TIME_BASE_Q);\n            if (ost->picref->video && !ost->frame_aspect_ratio)\n                ost->st->codec->sample_aspect_ratio = ost->picref->video->pixel_aspect;\n#else\n            filtered_frame = decoded_frame;\n#endif\n            do_video_out(output_files[ost->file_index].ctx, ost, ist, filtered_frame, &frame_size,\n                         same_quant ? quality : ost->st->codec->global_quality);\n            if (vstats_filename && frame_size)\n                do_video_stats(output_files[ost->file_index].ctx, ost, frame_size);\n#if CONFIG_AVFILTER\n            frame_available = ost->output_video_filter && avfilter_poll_frame(ost->output_video_filter->inputs[0]);\n            if (ost->picref)\n                avfilter_unref_buffer(ost->picref);\n        }\n#endif\n    }\n    av_free(buffer_to_free);\n    return ret;\n}', 'static void do_video_out(AVFormatContext *s,\n                         OutputStream *ost,\n                         InputStream *ist,\n                         AVFrame *in_picture,\n                         int *frame_size, float quality)\n{\n    int nb_frames, i, ret, format_video_sync;\n    AVFrame *final_picture;\n    AVCodecContext *enc;\n    double sync_ipts;\n    enc = ost->st->codec;\n    sync_ipts = get_sync_ipts(ost, in_picture->pts) / av_q2d(enc->time_base);\n    nb_frames = 1;\n    *frame_size = 0;\n    format_video_sync = video_sync_method;\n    if (format_video_sync == VSYNC_AUTO)\n        format_video_sync = (s->oformat->flags & AVFMT_NOTIMESTAMPS) ? VSYNC_PASSTHROUGH :\n                            (s->oformat->flags & AVFMT_VARIABLE_FPS) ? VSYNC_VFR : VSYNC_CFR;\n    if (format_video_sync != VSYNC_PASSTHROUGH) {\n        double vdelta = sync_ipts - ost->sync_opts;\n        if (vdelta < -1.1)\n            nb_frames = 0;\n        else if (format_video_sync == VSYNC_VFR) {\n            if (vdelta <= -0.6) {\n                nb_frames = 0;\n            } else if (vdelta > 0.6)\n                ost->sync_opts = lrintf(sync_ipts);\n        } else if (vdelta > 1.1)\n            nb_frames = lrintf(vdelta);\n        if (nb_frames == 0) {\n            ++nb_frames_drop;\n            av_log(NULL, AV_LOG_VERBOSE, "*** drop!\\n");\n        } else if (nb_frames > 1) {\n            nb_frames_dup += nb_frames - 1;\n            av_log(NULL, AV_LOG_VERBOSE, "*** %d dup!\\n", nb_frames - 1);\n        }\n    } else\n        ost->sync_opts = lrintf(sync_ipts);\n    nb_frames = FFMIN(nb_frames, ost->max_frames - ost->frame_number);\n    if (nb_frames <= 0)\n        return;\n#if !CONFIG_AVFILTER\n    do_video_resample(ost, ist, in_picture, &final_picture);\n#else\n    final_picture = in_picture;\n#endif\n    if (!ost->frame_number)\n        ost->first_pts = ost->sync_opts;\n    for (i = 0; i < nb_frames; i++) {\n        AVPacket pkt;\n        av_init_packet(&pkt);\n        pkt.data = NULL;\n        pkt.size = 0;\n        if (!check_recording_time(ost))\n            return;\n        if (s->oformat->flags & AVFMT_RAWPICTURE &&\n            enc->codec->id == CODEC_ID_RAWVIDEO) {\n            enc->coded_frame->interlaced_frame = in_picture->interlaced_frame;\n            enc->coded_frame->top_field_first  = in_picture->top_field_first;\n            pkt.data   = (uint8_t *)final_picture;\n            pkt.size   =  sizeof(AVPicture);\n            pkt.pts    = av_rescale_q(ost->sync_opts, enc->time_base, ost->st->time_base);\n            pkt.flags |= AV_PKT_FLAG_KEY;\n            write_frame(s, &pkt, ost);\n        } else {\n            int got_packet;\n            AVFrame big_picture;\n            big_picture = *final_picture;\n            big_picture.interlaced_frame = in_picture->interlaced_frame;\n            if (ost->st->codec->flags & (CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_INTERLACED_ME)) {\n                if (ost->top_field_first == -1)\n                    big_picture.top_field_first = in_picture->top_field_first;\n                else\n                    big_picture.top_field_first = !!ost->top_field_first;\n            }\n            big_picture.quality = quality;\n            if (!enc->me_threshold)\n                big_picture.pict_type = 0;\n            big_picture.pts = ost->sync_opts;\n            if (ost->forced_kf_index < ost->forced_kf_count &&\n                big_picture.pts >= ost->forced_kf_pts[ost->forced_kf_index]) {\n                big_picture.pict_type = AV_PICTURE_TYPE_I;\n                ost->forced_kf_index++;\n            }\n            ret = avcodec_encode_video2(enc, &pkt, &big_picture, &got_packet);\n            if (ret < 0) {\n                av_log(NULL, AV_LOG_FATAL, "Video encoding failed\\n");\n                exit_program(1);\n            }\n            if (got_packet) {\n                if (pkt.pts != AV_NOPTS_VALUE)\n                    pkt.pts = av_rescale_q(pkt.pts, enc->time_base, ost->st->time_base);\n                if (pkt.dts != AV_NOPTS_VALUE)\n                    pkt.dts = av_rescale_q(pkt.dts, enc->time_base, ost->st->time_base);\n                write_frame(s, &pkt, ost);\n                *frame_size = ret;\n                video_size += ret;\n                if (ost->logfile && enc->stats_out) {\n                    fprintf(ost->logfile, "%s", enc->stats_out);\n                }\n            }\n        }\n        ost->sync_opts++;\n        ost->frame_number++;\n    }\n}', 'void avfilter_unref_buffer(AVFilterBufferRef *ref)\n{\n    if (!ref)\n        return;\n    if (!(--ref->buf->refcount))\n        ref->buf->free(ref->buf);\n    av_free(ref->video);\n    av_free(ref->audio);\n    av_free(ref);\n}']