libavresample/audio_mix.c:573: error: Buffer Overrun L3
  Offset added: 128 Size: [0, +oo].

libavresample/audio_mix.c:557:1: <Length trace>
555. }
556. 
557. int ff_audio_mix_set_matrix(AudioMix *am, const double *matrix, int stride)
     ^
558. {
559.     int i, o, i0, o0;

libavresample/audio_mix.c:557:1: Parameter `am->input_skip[*]`
555. }
556. 
557. int ff_audio_mix_set_matrix(AudioMix *am, const double *matrix, int stride)
     ^
558. {
559.     int i, o, i0, o0;

libavresample/audio_mix.c:573:5: Array access: Offset added: 128 Size: [0, +oo]
571. 
572.     memset(am->output_zero, 0, sizeof(am->output_zero));
573.     memset(am->input_skip,  0, sizeof(am->input_skip));
         ^
574.     memset(am->output_skip, 0, sizeof(am->output_zero));
575.     am->in_matrix_channels  = am->in_channels;

int ff_audio_mix_set_matrix(AudioMix *am, const double *matrix, int stride)
{
    int i, o, i0, o0;
    if ( am->in_channels <= 0 ||  am->in_channels > AVRESAMPLE_MAX_CHANNELS ||
        am->out_channels <= 0 || am->out_channels > AVRESAMPLE_MAX_CHANNELS) {
        av_log(am->avr, AV_LOG_ERROR, "Invalid channel counts\n");
        return AVERROR(EINVAL);
    }
    if (am->matrix) {
        av_free(am->matrix[0]);
        am->matrix = NULL;
    }
    memset(am->output_zero, 0, sizeof(am->output_zero));
    memset(am->input_skip,  0, sizeof(am->input_skip));
    memset(am->output_skip, 0, sizeof(am->output_zero));
    am->in_matrix_channels  = am->in_channels;
    am->out_matrix_channels = am->out_channels;
    for (o = 0; o < am->out_channels; o++) {
        int zero = 1;
        for (i = 0; i < am->in_channels; i++) {
            if (matrix[o * stride + i] != 0.0) {
                zero = 0;
                break;
            }
        }
        if (o < am->in_channels) {
            for (i = 0; i < am->out_channels; i++) {
                if (matrix[i * stride + o] != 0.0) {
                    zero = 0;
                    break;
                }
            }
        }
        if (zero) {
            am->output_zero[o] = 1;
            am->out_matrix_channels--;
        }
    }
    if (am->out_matrix_channels == 0) {
        am->in_matrix_channels = 0;
        return 0;
    }
    for (i = 0; i < FFMIN(am->in_channels, am->out_channels); i++) {
        int skip = 1;
        for (o = 0; o < am->out_channels; o++) {
            if ((o != i && matrix[o * stride + i] != 0.0) ||
                (o == i && matrix[o * stride + i] != 1.0)) {
                skip = 0;
                break;
            }
        }
        if (skip) {
            am->input_skip[i] = 1;
            am->in_matrix_channels--;
        }
    }
    for (; i < am->in_channels; i++) {
        int contrib = 0;
        for (o = 0; o < am->out_channels; o++) {
            if (matrix[o * stride + i] != 0.0) {
                contrib = 1;
                break;
            }
        }
        if (!contrib) {
            am->input_skip[i] = 1;
            am->in_matrix_channels--;
        }
    }
    if (am->in_matrix_channels == 0) {
        am->out_matrix_channels = 0;
        return 0;
    }
    for (o = 0; o < FFMIN(am->in_channels, am->out_channels); o++) {
        int skip = 1;
        for (i = 0; i < am->in_channels; i++) {
            if ((o != i && matrix[o * stride + i] != 0.0) ||
                (o == i && matrix[o * stride + i] != 1.0)) {
                skip = 0;
                break;
            }
        }
        if (skip) {
            am->output_skip[o] = 1;
            am->out_matrix_channels--;
        }
    }
    if (am->out_matrix_channels == 0) {
        am->in_matrix_channels = 0;
        return 0;
    }
#define CONVERT_MATRIX(type, expr)                                          \
    am->matrix_## type[0] = av_mallocz(am->out_matrix_channels *            \
                                       am->in_matrix_channels  *            \
                                       sizeof(*am->matrix_## type[0]));     \
    if (!am->matrix_## type[0])                                             \
        return AVERROR(ENOMEM);                                             \
    for (o = 0, o0 = 0; o < am->out_channels; o++) {                        \
        if (am->output_zero[o] || am->output_skip[o])                       \
            continue;                                                       \
        if (o0 > 0)                                                         \
            am->matrix_## type[o0] = am->matrix_## type[o0 - 1] +           \
                                     am->in_matrix_channels;                \
        for (i = 0, i0 = 0; i < am->in_channels; i++) {                     \
            double v;                                                       \
            if (am->input_skip[i])                                          \
                continue;                                                   \
            v = matrix[o * stride + i];                                     \
            am->matrix_## type[o0][i0] = expr;                              \
            i0++;                                                           \
        }                                                                   \
        o0++;                                                               \
    }                                                                       \
    am->matrix = (void **)am->matrix_## type;
    switch (am->coeff_type) {
    case AV_MIX_COEFF_TYPE_Q8:
        CONVERT_MATRIX(q8, av_clip_int16(lrint(256.0 * v)))
        break;
    case AV_MIX_COEFF_TYPE_Q15:
        CONVERT_MATRIX(q15, av_clipl_int32(llrint(32768.0 * v)))
        break;
    case AV_MIX_COEFF_TYPE_FLT:
        CONVERT_MATRIX(flt, v)
        break;
    default:
        av_log(am->avr, AV_LOG_ERROR, "Invalid mix coeff type\n");
        return AVERROR(EINVAL);
    }
    return 0;
}
['int ff_audio_mix_set_matrix(AudioMix *am, const double *matrix, int stride)\n{\n    int i, o, i0, o0;\n    if ( am->in_channels <= 0 ||  am->in_channels > AVRESAMPLE_MAX_CHANNELS ||\n        am->out_channels <= 0 || am->out_channels > AVRESAMPLE_MAX_CHANNELS) {\n        av_log(am->avr, AV_LOG_ERROR, "Invalid channel counts\\n");\n        return AVERROR(EINVAL);\n    }\n    if (am->matrix) {\n        av_free(am->matrix[0]);\n        am->matrix = NULL;\n    }\n    memset(am->output_zero, 0, sizeof(am->output_zero));\n    memset(am->input_skip,  0, sizeof(am->input_skip));\n    memset(am->output_skip, 0, sizeof(am->output_zero));\n    am->in_matrix_channels  = am->in_channels;\n    am->out_matrix_channels = am->out_channels;\n    for (o = 0; o < am->out_channels; o++) {\n        int zero = 1;\n        for (i = 0; i < am->in_channels; i++) {\n            if (matrix[o * stride + i] != 0.0) {\n                zero = 0;\n                break;\n            }\n        }\n        if (o < am->in_channels) {\n            for (i = 0; i < am->out_channels; i++) {\n                if (matrix[i * stride + o] != 0.0) {\n                    zero = 0;\n                    break;\n                }\n            }\n        }\n        if (zero) {\n            am->output_zero[o] = 1;\n            am->out_matrix_channels--;\n        }\n    }\n    if (am->out_matrix_channels == 0) {\n        am->in_matrix_channels = 0;\n        return 0;\n    }\n    for (i = 0; i < FFMIN(am->in_channels, am->out_channels); i++) {\n        int skip = 1;\n        for (o = 0; o < am->out_channels; o++) {\n            if ((o != i && matrix[o * stride + i] != 0.0) ||\n                (o == i && matrix[o * stride + i] != 1.0)) {\n                skip = 0;\n                break;\n            }\n        }\n        if (skip) {\n            am->input_skip[i] = 1;\n            am->in_matrix_channels--;\n        }\n    }\n    for (; i < am->in_channels; i++) {\n        int contrib = 0;\n        for (o = 0; o < am->out_channels; o++) {\n            if (matrix[o * stride + i] != 0.0) {\n                contrib = 1;\n                break;\n            }\n        }\n        if (!contrib) {\n            am->input_skip[i] = 1;\n            am->in_matrix_channels--;\n        }\n    }\n    if (am->in_matrix_channels == 0) {\n        am->out_matrix_channels = 0;\n        return 0;\n    }\n    for (o = 0; o < FFMIN(am->in_channels, am->out_channels); o++) {\n        int skip = 1;\n        for (i = 0; i < am->in_channels; i++) {\n            if ((o != i && matrix[o * stride + i] != 0.0) ||\n                (o == i && matrix[o * stride + i] != 1.0)) {\n                skip = 0;\n                break;\n            }\n        }\n        if (skip) {\n            am->output_skip[o] = 1;\n            am->out_matrix_channels--;\n        }\n    }\n    if (am->out_matrix_channels == 0) {\n        am->in_matrix_channels = 0;\n        return 0;\n    }\n#define CONVERT_MATRIX(type, expr)                                          \\\n    am->matrix_## type[0] = av_mallocz(am->out_matrix_channels *            \\\n                                       am->in_matrix_channels  *            \\\n                                       sizeof(*am->matrix_## type[0]));     \\\n    if (!am->matrix_## type[0])                                             \\\n        return AVERROR(ENOMEM);                                             \\\n    for (o = 0, o0 = 0; o < am->out_channels; o++) {                        \\\n        if (am->output_zero[o] || am->output_skip[o])                       \\\n            continue;                                                       \\\n        if (o0 > 0)                                                         \\\n            am->matrix_## type[o0] = am->matrix_## type[o0 - 1] +           \\\n                                     am->in_matrix_channels;                \\\n        for (i = 0, i0 = 0; i < am->in_channels; i++) {                     \\\n            double v;                                                       \\\n            if (am->input_skip[i])                                          \\\n                continue;                                                   \\\n            v = matrix[o * stride + i];                                     \\\n            am->matrix_## type[o0][i0] = expr;                              \\\n            i0++;                                                           \\\n        }                                                                   \\\n        o0++;                                                               \\\n    }                                                                       \\\n    am->matrix = (void **)am->matrix_## type;\n    switch (am->coeff_type) {\n    case AV_MIX_COEFF_TYPE_Q8:\n        CONVERT_MATRIX(q8, av_clip_int16(lrint(256.0 * v)))\n        break;\n    case AV_MIX_COEFF_TYPE_Q15:\n        CONVERT_MATRIX(q15, av_clipl_int32(llrint(32768.0 * v)))\n        break;\n    case AV_MIX_COEFF_TYPE_FLT:\n        CONVERT_MATRIX(flt, v)\n        break;\n    default:\n        av_log(am->avr, AV_LOG_ERROR, "Invalid mix coeff type\\n");\n        return AVERROR(EINVAL);\n    }\n    return 0;\n}']