libavfilter/af_resample.c:198: error: Integer Overflow L2
  ([0, +oo] - 1):unsigned32 by call to `avfilter_unref_buffer`.

libavfilter/af_resample.c:187:19: Call
185.                                     AV_ROUND_UP);
186. 
187.         buf_out = ff_get_audio_buffer(outlink, AV_PERM_WRITE, nb_samples);
                       ^
188.         if (!buf_out) {
189.             ret = AVERROR(ENOMEM);

libavfilter/audio.c:63:1: Parameter `*link->dstpad->get_audio_buffer`
  61. }
  62. 
  63. AVFilterBufferRef *ff_get_audio_buffer(AVFilterLink *link, int perms,
      ^
  64.                                        int nb_samples)
  65. {

libavfilter/af_resample.c:198:13: Call
196.                                      buf->audio->nb_samples);
197.         if (ret <= 0) {
198.             avfilter_unref_buffer(buf_out);
                 ^
199.             if (ret < 0)
200.                 goto fail;

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

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

libavfilter/buffer.c:79:11: Binary operation: ([0, +oo] - 1):unsigned32 by call to `avfilter_unref_buffer` 
  77.     if (!ref)
  78.         return;
  79.     if (!(--ref->buf->refcount))
                ^
  80.         ref->buf->free(ref->buf);
  81.     if (ref->extended_data != ref->data)

void avfilter_unref_buffer(AVFilterBufferRef *ref)
{
    if (!ref)
        return;
    if (!(--ref->buf->refcount))
        ref->buf->free(ref->buf);
    if (ref->extended_data != ref->data)
        av_freep(&ref->extended_data);
    av_free(ref->video);
    av_free(ref->audio);
    av_free(ref);
}
['static int filter_samples(AVFilterLink *inlink, AVFilterBufferRef *buf)\n{\n    AVFilterContext  *ctx = inlink->dst;\n    ResampleContext    *s = ctx->priv;\n    AVFilterLink *outlink = ctx->outputs[0];\n    int ret;\n    if (s->avr) {\n        AVFilterBufferRef *buf_out;\n        int delay, nb_samples;\n        delay      = avresample_get_delay(s->avr);\n        nb_samples = av_rescale_rnd(buf->audio->nb_samples + delay,\n                                    outlink->sample_rate, inlink->sample_rate,\n                                    AV_ROUND_UP);\n        buf_out = ff_get_audio_buffer(outlink, AV_PERM_WRITE, nb_samples);\n        if (!buf_out) {\n            ret = AVERROR(ENOMEM);\n            goto fail;\n        }\n        ret     = avresample_convert(s->avr, buf_out->extended_data,\n                                     buf_out->linesize[0], nb_samples,\n                                     buf->extended_data, buf->linesize[0],\n                                     buf->audio->nb_samples);\n        if (ret <= 0) {\n            avfilter_unref_buffer(buf_out);\n            if (ret < 0)\n                goto fail;\n        }\n        av_assert0(!avresample_available(s->avr));\n        if (s->next_pts == AV_NOPTS_VALUE) {\n            if (buf->pts == AV_NOPTS_VALUE) {\n                av_log(ctx, AV_LOG_WARNING, "First timestamp is missing, "\n                       "assuming 0.\\n");\n                s->next_pts = 0;\n            } else\n                s->next_pts = av_rescale_q(buf->pts, inlink->time_base,\n                                           outlink->time_base);\n        }\n        if (ret > 0) {\n            buf_out->audio->nb_samples = ret;\n            if (buf->pts != AV_NOPTS_VALUE) {\n                buf_out->pts = av_rescale_q(buf->pts, inlink->time_base,\n                                            outlink->time_base) -\n                               av_rescale(delay, outlink->sample_rate,\n                                          inlink->sample_rate);\n            } else\n                buf_out->pts = s->next_pts;\n            s->next_pts = buf_out->pts + buf_out->audio->nb_samples;\n            ret = ff_filter_samples(outlink, buf_out);\n            s->got_output = 1;\n        }\nfail:\n        avfilter_unref_buffer(buf);\n    } else {\n        buf->format = outlink->format;\n        ret = ff_filter_samples(outlink, buf);\n        s->got_output = 1;\n    }\n    return ret;\n}', 'AVFilterBufferRef *ff_get_audio_buffer(AVFilterLink *link, int perms,\n                                       int nb_samples)\n{\n    AVFilterBufferRef *ret = NULL;\n    if (link->dstpad->get_audio_buffer)\n        ret = link->dstpad->get_audio_buffer(link, perms, nb_samples);\n    if (!ret)\n        ret = ff_default_get_audio_buffer(link, perms, nb_samples);\n    if (ret)\n        ret->type = AVMEDIA_TYPE_AUDIO;\n    return ret;\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    if (ref->extended_data != ref->data)\n        av_freep(&ref->extended_data);\n    av_free(ref->video);\n    av_free(ref->audio);\n    av_free(ref);\n}']