libavfilter/af_channelmap.c:327: error: Buffer Overrun L2
  Offset added: [0, 1008] Size: 512.

libavfilter/af_channelmap.c:322:24: <Offset trace>
320.     AVFilterLink *outlink = ctx->outputs[0];
321.     const ChannelMapContext *s = ctx->priv;
322.     const int nch_in = av_get_channel_layout_nb_channels(inlink->channel_layout);
                            ^
323.     const int nch_out = s->nch;
324.     int ch;

libavfilter/af_channelmap.c:322:24: Call
320.     AVFilterLink *outlink = ctx->outputs[0];
321.     const ChannelMapContext *s = ctx->priv;
322.     const int nch_in = av_get_channel_layout_nb_channels(inlink->channel_layout);
                            ^
323.     const int nch_out = s->nch;
324.     int ch;

libavutil/audioconvert.c:178:12: Call
  176. int av_get_channel_layout_nb_channels(uint64_t channel_layout)
  177. {
  178.     return av_popcount64(channel_layout);
                  ^
  179. }
  180. 

libavutil/common.h:228:12: Call
    226. static av_always_inline av_const int av_popcount64_c(uint64_t x)
    227. {
    228.     return av_popcount(x) + av_popcount(x >> 32);
                    ^
    229. }
    230. 

libavutil/common.h:212:1: Parameter `x`
      210.  * @return the number of bits set to one in x
      211.  */
      212. static av_always_inline av_const int av_popcount_c(uint32_t x)
           ^
      213. {
      214.     x -= (x >> 1) & 0x55555555;

libavutil/common.h:214:5: Assignment
      212. static av_always_inline av_const int av_popcount_c(uint32_t x)
      213. {
      214.     x -= (x >> 1) & 0x55555555;
               ^
      215.     x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
      216.     x = (x + (x >> 4)) & 0x0F0F0F0F;

libavutil/common.h:215:5: Assignment
      213. {
      214.     x -= (x >> 1) & 0x55555555;
      215.     x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
               ^
      216.     x = (x + (x >> 4)) & 0x0F0F0F0F;
      217.     x += x >> 8;

libavutil/common.h:216:5: Assignment
      214.     x -= (x >> 1) & 0x55555555;
      215.     x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
      216.     x = (x + (x >> 4)) & 0x0F0F0F0F;
               ^
      217.     x += x >> 8;
      218.     return (x + (x >> 16)) & 0x3F;

libavutil/common.h:217:5: Assignment
      215.     x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
      216.     x = (x + (x >> 4)) & 0x0F0F0F0F;
      217.     x += x >> 8;
               ^
      218.     return (x + (x >> 16)) & 0x3F;
      219. }

libavutil/common.h:218:5: Assignment
      216.     x = (x + (x >> 4)) & 0x0F0F0F0F;
      217.     x += x >> 8;
      218.     return (x + (x >> 16)) & 0x3F;
               ^
      219. }
      220. 

libavutil/common.h:228:5: Assignment
    226. static av_always_inline av_const int av_popcount64_c(uint64_t x)
    227. {
    228.     return av_popcount(x) + av_popcount(x >> 32);
             ^
    229. }
    230. 

libavutil/audioconvert.c:178:5: Assignment
  176. int av_get_channel_layout_nb_channels(uint64_t channel_layout)
  177. {
  178.     return av_popcount64(channel_layout);
           ^
  179. }
  180. 

libavfilter/af_channelmap.c:322:5: Assignment
320.     AVFilterLink *outlink = ctx->outputs[0];
321.     const ChannelMapContext *s = ctx->priv;
322.     const int nch_in = av_get_channel_layout_nb_channels(inlink->channel_layout);
         ^
323.     const int nch_out = s->nch;
324.     int ch;

libavfilter/af_channelmap.c:317:1: <Length trace>
315. }
316. 
317. static void channelmap_filter_samples(AVFilterLink *inlink, AVFilterBufferRef *buf)
     ^
318. {
319.     AVFilterContext  *ctx = inlink->dst;

libavfilter/af_channelmap.c:317:1: Array declaration
315. }
316. 
317. static void channelmap_filter_samples(AVFilterLink *inlink, AVFilterBufferRef *buf)
     ^
318. {
319.     AVFilterContext  *ctx = inlink->dst;

libavfilter/af_channelmap.c:327:5: Array access: Offset added: [0, 1008] Size: 512
325.     uint8_t *source_planes[MAX_CH];
326. 
327.     memcpy(source_planes, buf->extended_data,
         ^
328.            nch_in * sizeof(source_planes[0]));
329. 

static void channelmap_filter_samples(AVFilterLink *inlink, AVFilterBufferRef *buf)
{
    AVFilterContext  *ctx = inlink->dst;
    AVFilterLink *outlink = ctx->outputs[0];
    const ChannelMapContext *s = ctx->priv;
    const int nch_in = av_get_channel_layout_nb_channels(inlink->channel_layout);
    const int nch_out = s->nch;
    int ch;
    uint8_t *source_planes[MAX_CH];
    memcpy(source_planes, buf->extended_data,
           nch_in * sizeof(source_planes[0]));
    if (nch_out > nch_in) {
        if (nch_out > FF_ARRAY_ELEMS(buf->data)) {
            uint8_t **new_extended_data =
                av_mallocz(nch_out * sizeof(*buf->extended_data));
            if (!new_extended_data)
                return;
            if (buf->extended_data == buf->data) {
                buf->extended_data = new_extended_data;
            } else {
                buf->extended_data = new_extended_data;
                av_free(buf->extended_data);
            }
        } else if (buf->extended_data != buf->data) {
            av_free(buf->extended_data);
            buf->extended_data = buf->data;
        }
    }
    for (ch = 0; ch < nch_out; ch++) {
        buf->extended_data[s->map[ch].out_channel_idx] =
            source_planes[s->map[ch].in_channel_idx];
    }
    if (buf->data != buf->extended_data)
        memcpy(buf->data, buf->extended_data,
           FFMIN(FF_ARRAY_ELEMS(buf->data), nch_out) * sizeof(buf->data[0]));
    ff_filter_samples(outlink, buf);
}
['static void channelmap_filter_samples(AVFilterLink *inlink, AVFilterBufferRef *buf)\n{\n    AVFilterContext  *ctx = inlink->dst;\n    AVFilterLink *outlink = ctx->outputs[0];\n    const ChannelMapContext *s = ctx->priv;\n    const int nch_in = av_get_channel_layout_nb_channels(inlink->channel_layout);\n    const int nch_out = s->nch;\n    int ch;\n    uint8_t *source_planes[MAX_CH];\n    memcpy(source_planes, buf->extended_data,\n           nch_in * sizeof(source_planes[0]));\n    if (nch_out > nch_in) {\n        if (nch_out > FF_ARRAY_ELEMS(buf->data)) {\n            uint8_t **new_extended_data =\n                av_mallocz(nch_out * sizeof(*buf->extended_data));\n            if (!new_extended_data)\n                return;\n            if (buf->extended_data == buf->data) {\n                buf->extended_data = new_extended_data;\n            } else {\n                buf->extended_data = new_extended_data;\n                av_free(buf->extended_data);\n            }\n        } else if (buf->extended_data != buf->data) {\n            av_free(buf->extended_data);\n            buf->extended_data = buf->data;\n        }\n    }\n    for (ch = 0; ch < nch_out; ch++) {\n        buf->extended_data[s->map[ch].out_channel_idx] =\n            source_planes[s->map[ch].in_channel_idx];\n    }\n    if (buf->data != buf->extended_data)\n        memcpy(buf->data, buf->extended_data,\n           FFMIN(FF_ARRAY_ELEMS(buf->data), nch_out) * sizeof(buf->data[0]));\n    ff_filter_samples(outlink, buf);\n}', 'int av_get_channel_layout_nb_channels(uint64_t channel_layout)\n{\n    return av_popcount64(channel_layout);\n}', 'static av_always_inline av_const int av_popcount64_c(uint64_t x)\n{\n    return av_popcount(x) + av_popcount(x >> 32);\n}', 'static av_always_inline av_const int av_popcount_c(uint32_t x)\n{\n    x -= (x >> 1) & 0x55555555;\n    x = (x & 0x33333333) + ((x >> 2) & 0x33333333);\n    x = (x + (x >> 4)) & 0x0F0F0F0F;\n    x += x >> 8;\n    return (x + (x >> 16)) & 0x3F;\n}']