libavfilter/vf_pad.c:441: error: Integer Overflow L1
  (0 - 1):unsigned32 by call to `avfilter_unref_buffer`.

libavfilter/vf_pad.c:433:5: Assignment
431.     picref->video->pixel_aspect = (AVRational) {1, 1};
432.     picref->pts                 = av_rescale_q(color->pts++, color->time_base, AV_TIME_BASE_Q);
433.     picref->pos                 = 0;
         ^
434. 
435.     avfilter_start_frame(link, avfilter_ref_buffer(picref, ~0));

libavfilter/vf_pad.c:435:32: Call
433.     picref->pos                 = 0;
434. 
435.     avfilter_start_frame(link, avfilter_ref_buffer(picref, ~0));
                                    ^
436.     draw_rectangle(picref,
437.                    color->line, color->line_step, color->hsub, color->vsub,

libavfilter/avfilter.c:48:1: Parameter `ref->type`
  46. #define link_spad(link)     link->src->output_pads[link->srcpad]
  47. 
  48. AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask)
      ^
  49. {
  50.     AVFilterBufferRef *ret = av_malloc(sizeof(AVFilterBufferRef));

libavfilter/vf_pad.c:435:5: Call
433.     picref->pos                 = 0;
434. 
435.     avfilter_start_frame(link, avfilter_ref_buffer(picref, ~0));
         ^
436.     draw_rectangle(picref,
437.                    color->line, color->line_step, color->hsub, color->vsub,

libavfilter/avfilter.c:250:1: Parameter `picref->type`
  248. /* XXX: should we do the duplicating of the picture ref here, instead of
  249.  * forcing the source filter to do it? */
  250. void avfilter_start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
       ^
  251. {
  252.     void (*start_frame)(AVFilterLink *, AVFilterBufferRef *);

libavfilter/vf_pad.c:436:5: Call
434. 
435.     avfilter_start_frame(link, avfilter_ref_buffer(picref, ~0));
436.     draw_rectangle(picref,
         ^
437.                    color->line, color->line_step, color->hsub, color->vsub,
438.                    0, 0, color->w, color->h);

libavfilter/vf_pad.c:86:1: Parameter `outpic->linesize[*]`
  84. }
  85. 
  86. static void draw_rectangle(AVFilterBufferRef *outpic, uint8_t *line[4], int line_step[4],
      ^
  87.                            int hsub, int vsub, int x, int y, int w, int h)
  88. {

libavfilter/vf_pad.c:439:5: Call
437.                    color->line, color->line_step, color->hsub, color->vsub,
438.                    0, 0, color->w, color->h);
439.     avfilter_draw_slice(link, 0, color->h, 1);
         ^
440.     avfilter_end_frame(link);
441.     avfilter_unref_buffer(picref);

libavfilter/avfilter.c:298:1: Parameter `link->cur_buf->linesize[*]`
  296. }
  297. 
  298. void avfilter_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
       ^
  299. {
  300.     uint8_t *src[4], *dst[4];

libavfilter/vf_pad.c:441:5: Call
439.     avfilter_draw_slice(link, 0, color->h, 1);
440.     avfilter_end_frame(link);
441.     avfilter_unref_buffer(picref);
         ^
442. 
443.     return 0;

libavfilter/avfilter.c:61:1: <LHS trace>
59. }
60. 
61. void avfilter_unref_buffer(AVFilterBufferRef *ref)
    ^
62. {
63.     if(!(--ref->buf->refcount))

libavfilter/avfilter.c:61:1: Parameter `ref->buf->refcount`
  59. }
  60. 
  61. void avfilter_unref_buffer(AVFilterBufferRef *ref)
      ^
  62. {
  63.     if(!(--ref->buf->refcount))

libavfilter/avfilter.c:63:10: Binary operation: (0 - 1):unsigned32 by call to `avfilter_unref_buffer` 
  61. void avfilter_unref_buffer(AVFilterBufferRef *ref)
  62. {
  63.     if(!(--ref->buf->refcount))
               ^
  64.         ref->buf->free(ref->buf);
  65.     av_free(ref->video);

void avfilter_unref_buffer(AVFilterBufferRef *ref)
{
    if(!(--ref->buf->refcount))
        ref->buf->free(ref->buf);
    av_free(ref->video);
    av_free(ref);
}
['static int color_request_frame(AVFilterLink *link)\n{\n    ColorContext *color = link->src->priv;\n    AVFilterBufferRef *picref = avfilter_get_video_buffer(link, AV_PERM_WRITE, color->w, color->h);\n    picref->video->pixel_aspect = (AVRational) {1, 1};\n    picref->pts                 = av_rescale_q(color->pts++, color->time_base, AV_TIME_BASE_Q);\n    picref->pos                 = 0;\n    avfilter_start_frame(link, avfilter_ref_buffer(picref, ~0));\n    draw_rectangle(picref,\n                   color->line, color->line_step, color->hsub, color->vsub,\n                   0, 0, color->w, color->h);\n    avfilter_draw_slice(link, 0, color->h, 1);\n    avfilter_end_frame(link);\n    avfilter_unref_buffer(picref);\n    return 0;\n}', 'AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask)\n{\n    AVFilterBufferRef *ret = av_malloc(sizeof(AVFilterBufferRef));\n    *ret = *ref;\n    if (ref->type == AVMEDIA_TYPE_VIDEO) {\n        ret->video = av_malloc(sizeof(AVFilterBufferRefVideoProps));\n        *ret->video = *ref->video;\n    }\n    ret->perms &= pmask;\n    ret->buf->refcount ++;\n    return ret;\n}', 'void avfilter_start_frame(AVFilterLink *link, AVFilterBufferRef *picref)\n{\n    void (*start_frame)(AVFilterLink *, AVFilterBufferRef *);\n    AVFilterPad *dst = &link_dpad(link);\n    FF_DPRINTF_START(NULL, start_frame); ff_dprintf_link(NULL, link, 0); dprintf(NULL, " "); ff_dprintf_picref(NULL, picref, 1);\n    if(!(start_frame = dst->start_frame))\n        start_frame = avfilter_default_start_frame;\n    if((dst->min_perms & picref->perms) != dst->min_perms ||\n        dst->rej_perms & picref->perms) {\n        link->cur_buf = avfilter_default_get_video_buffer(link, dst->min_perms, link->w, link->h);\n        link->src_buf = picref;\n        avfilter_copy_buffer_ref_props(link->cur_buf, link->src_buf);\n    }\n    else\n        link->cur_buf = picref;\n    start_frame(link, link->cur_buf);\n}', 'static void draw_rectangle(AVFilterBufferRef *outpic, uint8_t *line[4], int line_step[4],\n                           int hsub, int vsub, int x, int y, int w, int h)\n{\n    int i, plane;\n    uint8_t *p;\n    for (plane = 0; plane < 4 && outpic->data[plane]; plane++) {\n        int hsub1 = plane == 1 || plane == 2 ? hsub : 0;\n        int vsub1 = plane == 1 || plane == 2 ? vsub : 0;\n        p = outpic->data[plane] + (y >> vsub1) * outpic->linesize[plane];\n        for (i = 0; i < (h >> vsub1); i++) {\n            memcpy(p + (x >> hsub1) * line_step[plane], line[plane], (w >> hsub1) * line_step[plane]);\n            p += outpic->linesize[plane];\n        }\n    }\n}', 'void avfilter_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)\n{\n    uint8_t *src[4], *dst[4];\n    int i, j, vsub;\n    void (*draw_slice)(AVFilterLink *, int, int, int);\n    FF_DPRINTF_START(NULL, draw_slice); ff_dprintf_link(NULL, link, 0); dprintf(NULL, " y:%d h:%d dir:%d\\n", y, h, slice_dir);\n    if(link->src_buf) {\n        vsub = av_pix_fmt_descriptors[link->format].log2_chroma_h;\n        for(i = 0; i < 4; i ++) {\n            if(link->src_buf->data[i]) {\n                src[i] = link->src_buf-> data[i] +\n                    (y >> (i==0 ? 0 : vsub)) * link->src_buf-> linesize[i];\n                dst[i] = link->cur_buf->data[i] +\n                    (y >> (i==0 ? 0 : vsub)) * link->cur_buf->linesize[i];\n            } else\n                src[i] = dst[i] = NULL;\n        }\n        for(i = 0; i < 4; i ++) {\n            int planew =\n                ff_get_plane_bytewidth(link->format, link->cur_buf->video->w, i);\n            if(!src[i]) continue;\n            for(j = 0; j < h >> (i==0 ? 0 : vsub); j ++) {\n                memcpy(dst[i], src[i], planew);\n                src[i] += link->src_buf ->linesize[i];\n                dst[i] += link->cur_buf->linesize[i];\n            }\n        }\n    }\n    if(!(draw_slice = link_dpad(link).draw_slice))\n        draw_slice = avfilter_default_draw_slice;\n    draw_slice(link, y, h, slice_dir);\n}', 'void avfilter_unref_buffer(AVFilterBufferRef *ref)\n{\n    if(!(--ref->buf->refcount))\n        ref->buf->free(ref->buf);\n    av_free(ref->video);\n    av_free(ref);\n}']