libavfilter/af_channelmap.c:294: error: Integer Overflow L2
  ([0, +oo] - 1):unsigned64 by call to `av_get_channel_layout_channel_index`.

libavfilter/af_channelmap.c:153:17: Unknown value from: __ctype_b_loc
151.         char *dash = strchr(mapping, '-');
152.         if (!dash) {  // short mapping
153.             if (isdigit(*mapping))
                     ^
154.                 mode = MAP_ONE_INT;
155.             else

libavfilter/af_channelmap.c:294:41: Call
292.     if (mode == MAP_PAIR_INT_STR || mode == MAP_PAIR_STR_STR) {
293.         for (i = 0; i < s->nch; i++) {
294.             s->map[i].out_channel_idx = av_get_channel_layout_channel_index(
                                             ^
295.                 s->output_layout, s->map[i].out_channel);
296.         }

libavutil/audioconvert.c:198:1: <LHS trace>
196. }
197. 
198. int av_get_channel_layout_channel_index(uint64_t channel_layout,
     ^
199.                                         uint64_t channel)
200. {

libavutil/audioconvert.c:198:1: Parameter `channel`
  196. }
  197. 
  198. int av_get_channel_layout_channel_index(uint64_t channel_layout,
       ^
  199.                                         uint64_t channel)
  200. {

libavutil/audioconvert.c:204:5: Binary operation: ([0, +oo] - 1):unsigned64 by call to `av_get_channel_layout_channel_index` 
  202.         av_get_channel_layout_nb_channels(channel) != 1)
  203.         return AVERROR(EINVAL);
  204.     channel_layout &= channel - 1;
           ^
  205.     return av_get_channel_layout_nb_channels(channel_layout);
  206. }

int av_get_channel_layout_channel_index(uint64_t channel_layout,
                                        uint64_t channel)
{
    if (!(channel_layout & channel) ||
        av_get_channel_layout_nb_channels(channel) != 1)
        return AVERROR(EINVAL);
    channel_layout &= channel - 1;
    return av_get_channel_layout_nb_channels(channel_layout);
}
['static av_cold int channelmap_init(AVFilterContext *ctx, const char *args)\n{\n    ChannelMapContext *s = ctx->priv;\n    int ret;\n    char *mapping;\n    int map_entries = 0;\n    char buf[256];\n    enum MappingMode mode;\n    uint64_t out_ch_mask = 0;\n    int i;\n    if (!args) {\n        av_log(ctx, AV_LOG_ERROR, "No parameters supplied.\\n");\n        return AVERROR(EINVAL);\n    }\n    s->class = &channelmap_class;\n    av_opt_set_defaults(s);\n    if ((ret = av_set_options_string(s, args, "=", ":")) < 0) {\n        av_log(ctx, AV_LOG_ERROR, "Error parsing options string \'%s\'.\\n", args);\n        return ret;\n    }\n    mapping = s->mapping_str;\n    if (!mapping) {\n        mode = MAP_NONE;\n    } else {\n        char *dash = strchr(mapping, \'-\');\n        if (!dash) {\n            if (isdigit(*mapping))\n                mode = MAP_ONE_INT;\n            else\n                mode = MAP_ONE_STR;\n        } else if (isdigit(*mapping)) {\n            if (isdigit(*(dash+1)))\n                mode = MAP_PAIR_INT_INT;\n            else\n                mode = MAP_PAIR_INT_STR;\n        } else {\n            if (isdigit(*(dash+1)))\n                mode = MAP_PAIR_STR_INT;\n            else\n                mode = MAP_PAIR_STR_STR;\n        }\n    }\n    if (mode != MAP_NONE) {\n        char *comma = mapping;\n        map_entries = 1;\n        while ((comma = strchr(comma, \',\'))) {\n            if (*++comma)\n                map_entries++;\n        }\n    }\n    if (map_entries > MAX_CH) {\n        av_log(ctx, AV_LOG_ERROR, "Too many channels mapped: \'%d\'.\\n", map_entries);\n        ret = AVERROR(EINVAL);\n        goto fail;\n    }\n    for (i = 0; i < map_entries; i++) {\n        int in_ch_idx = -1, out_ch_idx = -1;\n        uint64_t in_ch = 0, out_ch = 0;\n        static const char err[] = "Failed to parse channel map\\n";\n        switch (mode) {\n        case MAP_ONE_INT:\n            if (get_channel_idx(&mapping, &in_ch_idx, \',\', MAX_CH) < 0) {\n                ret = AVERROR(EINVAL);\n                av_log(ctx, AV_LOG_ERROR, err);\n                goto fail;\n            }\n            s->map[i].in_channel_idx  = in_ch_idx;\n            s->map[i].out_channel_idx = i;\n            break;\n        case MAP_ONE_STR:\n            if (!get_channel(&mapping, &in_ch, \',\')) {\n                av_log(ctx, AV_LOG_ERROR, err);\n                ret = AVERROR(EINVAL);\n                goto fail;\n            }\n            s->map[i].in_channel      = in_ch;\n            s->map[i].out_channel_idx = i;\n            break;\n        case MAP_PAIR_INT_INT:\n            if (get_channel_idx(&mapping, &in_ch_idx, \'-\', MAX_CH) < 0 ||\n                get_channel_idx(&mapping, &out_ch_idx, \',\', MAX_CH) < 0) {\n                av_log(ctx, AV_LOG_ERROR, err);\n                ret = AVERROR(EINVAL);\n                goto fail;\n            }\n            s->map[i].in_channel_idx  = in_ch_idx;\n            s->map[i].out_channel_idx = out_ch_idx;\n            break;\n        case MAP_PAIR_INT_STR:\n            if (get_channel_idx(&mapping, &in_ch_idx, \'-\', MAX_CH) < 0 ||\n                get_channel(&mapping, &out_ch, \',\') < 0 ||\n                out_ch & out_ch_mask) {\n                av_log(ctx, AV_LOG_ERROR, err);\n                ret = AVERROR(EINVAL);\n                goto fail;\n            }\n            s->map[i].in_channel_idx  = in_ch_idx;\n            s->map[i].out_channel     = out_ch;\n            out_ch_mask |= out_ch;\n            break;\n        case MAP_PAIR_STR_INT:\n            if (get_channel(&mapping, &in_ch, \'-\') < 0 ||\n                get_channel_idx(&mapping, &out_ch_idx, \',\', MAX_CH) < 0) {\n                av_log(ctx, AV_LOG_ERROR, err);\n                ret = AVERROR(EINVAL);\n                goto fail;\n            }\n            s->map[i].in_channel      = in_ch;\n            s->map[i].out_channel_idx = out_ch_idx;\n            break;\n        case MAP_PAIR_STR_STR:\n            if (get_channel(&mapping, &in_ch, \'-\') < 0 ||\n                get_channel(&mapping, &out_ch, \',\') < 0 ||\n                out_ch & out_ch_mask) {\n                av_log(ctx, AV_LOG_ERROR, err);\n                ret = AVERROR(EINVAL);\n                goto fail;\n            }\n            s->map[i].in_channel = in_ch;\n            s->map[i].out_channel = out_ch;\n            out_ch_mask |= out_ch;\n            break;\n        }\n    }\n    s->mode          = mode;\n    s->nch           = map_entries;\n    s->output_layout = out_ch_mask ? out_ch_mask :\n                       av_get_default_channel_layout(map_entries);\n    if (s->channel_layout_str) {\n        uint64_t fmt;\n        if ((fmt = av_get_channel_layout(s->channel_layout_str)) == 0) {\n            av_log(ctx, AV_LOG_ERROR, "Error parsing channel layout: \'%s\'.\\n",\n                   s->channel_layout_str);\n            ret = AVERROR(EINVAL);\n            goto fail;\n        }\n        if (mode == MAP_NONE) {\n            int i;\n            s->nch = av_get_channel_layout_nb_channels(fmt);\n            for (i = 0; i < s->nch; i++) {\n                s->map[i].in_channel_idx  = i;\n                s->map[i].out_channel_idx = i;\n            }\n        } else if (out_ch_mask && out_ch_mask != fmt) {\n            av_get_channel_layout_string(buf, sizeof(buf), 0, out_ch_mask);\n            av_log(ctx, AV_LOG_ERROR,\n                   "Output channel layout \'%s\' does not match the list of channel mapped: \'%s\'.\\n",\n                   s->channel_layout_str, buf);\n            ret = AVERROR(EINVAL);\n            goto fail;\n        } else if (s->nch != av_get_channel_layout_nb_channels(fmt)) {\n            av_log(ctx, AV_LOG_ERROR,\n                   "Output channel layout %s does not match the number of channels mapped %d.\\n",\n                   s->channel_layout_str, s->nch);\n            ret = AVERROR(EINVAL);\n            goto fail;\n        }\n        s->output_layout = fmt;\n    }\n    ff_add_channel_layout(&s->channel_layouts, s->output_layout);\n    if (mode == MAP_PAIR_INT_STR || mode == MAP_PAIR_STR_STR) {\n        for (i = 0; i < s->nch; i++) {\n            s->map[i].out_channel_idx = av_get_channel_layout_channel_index(\n                s->output_layout, s->map[i].out_channel);\n        }\n    }\nfail:\n    av_opt_free(s);\n    return ret;\n}', 'int av_get_channel_layout_channel_index(uint64_t channel_layout,\n                                        uint64_t channel)\n{\n    if (!(channel_layout & channel) ||\n        av_get_channel_layout_nb_channels(channel) != 1)\n        return AVERROR(EINVAL);\n    channel_layout &= channel - 1;\n    return av_get_channel_layout_nb_channels(channel_layout);\n}']