libavcodec/aacps.c:783: error: Buffer Overrun L1
  Offset: [19, `ps->num_env` + 18] (⇐ [0, `ps->num_env` - 1] + 19) Size: 5 by call to `remap20`.

libavcodec/aacps.c:731:1: Parameter `ps->num_env`
729. }
730. 
731. static void stereo_processing(PSContext *ps, float (*l)[32][2], float (*r)[32][2], int is34)
     ^
732. {
733.     int e, b, k;

libavcodec/aacps.c:783:9: Call
781.         }
782.     } else {
783.         remap20(&iid_mapped, ps->iid_par, ps->nr_iid_par, ps->num_env, 1);
             ^
784.         remap20(&icc_mapped, ps->icc_par, ps->nr_icc_par, ps->num_env, 1);
785.         if (ps->enable_ipdopd) {

libavcodec/aacps.c:712:1: Parameter `num_env`
  710. }
  711. 
  712. static void remap20(int8_t (**p_par_mapped)[PS_MAX_NR_IIDICC],
       ^
  713.                     int8_t           (*par)[PS_MAX_NR_IIDICC],
  714.                     int num_par, int num_env, int full)

libavcodec/aacps.c:720:13: Call
  718.     if (num_par == 34 || num_par == 17) {
  719.         for (e = 0; e < num_env; e++) {
  720.             map_idx_34_to_20(par_mapped[e], par[e], full);
                   ^
  721.         }
  722.     } else if (num_par == 10 || num_par == 5) {

libavcodec/aacps.c:439:1: <Length trace>
437. }
438. 
439. static void map_idx_34_to_20(int8_t *par_mapped, const int8_t *par, int full)
     ^
440. {
441.     par_mapped[ 0] = (2*par[ 0] +   par[ 1]) / 3;

libavcodec/aacps.c:439:1: Parameter `*par_mapped`
    437. }
    438. 
    439. static void map_idx_34_to_20(int8_t *par_mapped, const int8_t *par, int full)
         ^
    440. {
    441.     par_mapped[ 0] = (2*par[ 0] +   par[ 1]) / 3;

libavcodec/aacps.c:461:9: Array access: Offset: [19, ps->num_env + 18] (⇐ [0, ps->num_env - 1] + 19) Size: 5 by call to `remap20` 
    459.         par_mapped[17] = (  par[26] +   par[27]) / 2;
    460.         par_mapped[18] = (  par[28] +   par[29] +   par[30] +   par[31]) / 4;
    461.         par_mapped[19] = (  par[32] +   par[33]) / 2;
                 ^
    462.     }
    463. }

static void map_idx_34_to_20(int8_t *par_mapped, const int8_t *par, int full)
{
    par_mapped[ 0] = (2*par[ 0] +   par[ 1]) / 3;
    par_mapped[ 1] = (  par[ 1] + 2*par[ 2]) / 3;
    par_mapped[ 2] = (2*par[ 3] +   par[ 4]) / 3;
    par_mapped[ 3] = (  par[ 4] + 2*par[ 5]) / 3;
    par_mapped[ 4] = (  par[ 6] +   par[ 7]) / 2;
    par_mapped[ 5] = (  par[ 8] +   par[ 9]) / 2;
    par_mapped[ 6] =    par[10];
    par_mapped[ 7] =    par[11];
    par_mapped[ 8] = (  par[12] +   par[13]) / 2;
    par_mapped[ 9] = (  par[14] +   par[15]) / 2;
    par_mapped[10] =    par[16];
    if (full) {
        par_mapped[11] =    par[17];
        par_mapped[12] =    par[18];
        par_mapped[13] =    par[19];
        par_mapped[14] = (  par[20] +   par[21]) / 2;
        par_mapped[15] = (  par[22] +   par[23]) / 2;
        par_mapped[16] = (  par[24] +   par[25]) / 2;
        par_mapped[17] = (  par[26] +   par[27]) / 2;
        par_mapped[18] = (  par[28] +   par[29] +   par[30] +   par[31]) / 4;
        par_mapped[19] = (  par[32] +   par[33]) / 2;
    }
}
['static void stereo_processing(PSContext *ps, float (*l)[32][2], float (*r)[32][2], int is34)\n{\n    int e, b, k;\n    float (*H11)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = ps->H11;\n    float (*H12)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = ps->H12;\n    float (*H21)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = ps->H21;\n    float (*H22)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = ps->H22;\n    int8_t *opd_hist = ps->opd_hist;\n    int8_t *ipd_hist = ps->ipd_hist;\n    int8_t iid_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC];\n    int8_t icc_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC];\n    int8_t ipd_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC];\n    int8_t opd_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC];\n    int8_t (*iid_mapped)[PS_MAX_NR_IIDICC] = iid_mapped_buf;\n    int8_t (*icc_mapped)[PS_MAX_NR_IIDICC] = icc_mapped_buf;\n    int8_t (*ipd_mapped)[PS_MAX_NR_IIDICC] = ipd_mapped_buf;\n    int8_t (*opd_mapped)[PS_MAX_NR_IIDICC] = opd_mapped_buf;\n    const int8_t *k_to_i = is34 ? k_to_i_34 : k_to_i_20;\n    const float (*H_LUT)[8][4] = (PS_BASELINE || ps->icc_mode < 3) ? HA : HB;\n    if (ps->num_env_old) {\n        memcpy(H11[0][0], H11[0][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H11[0][0][0]));\n        memcpy(H11[1][0], H11[1][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H11[1][0][0]));\n        memcpy(H12[0][0], H12[0][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H12[0][0][0]));\n        memcpy(H12[1][0], H12[1][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H12[1][0][0]));\n        memcpy(H21[0][0], H21[0][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H21[0][0][0]));\n        memcpy(H21[1][0], H21[1][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H21[1][0][0]));\n        memcpy(H22[0][0], H22[0][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H22[0][0][0]));\n        memcpy(H22[1][0], H22[1][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H22[1][0][0]));\n    }\n    if (is34) {\n        remap34(&iid_mapped, ps->iid_par, ps->nr_iid_par, ps->num_env, 1);\n        remap34(&icc_mapped, ps->icc_par, ps->nr_icc_par, ps->num_env, 1);\n        if (ps->enable_ipdopd) {\n            remap34(&ipd_mapped, ps->ipd_par, ps->nr_ipdopd_par, ps->num_env, 0);\n            remap34(&opd_mapped, ps->opd_par, ps->nr_ipdopd_par, ps->num_env, 0);\n        }\n        if (!ps->is34bands_old) {\n            map_val_20_to_34(H11[0][0]);\n            map_val_20_to_34(H11[1][0]);\n            map_val_20_to_34(H12[0][0]);\n            map_val_20_to_34(H12[1][0]);\n            map_val_20_to_34(H21[0][0]);\n            map_val_20_to_34(H21[1][0]);\n            map_val_20_to_34(H22[0][0]);\n            map_val_20_to_34(H22[1][0]);\n            ipdopd_reset(ipd_hist, opd_hist);\n        }\n    } else {\n        remap20(&iid_mapped, ps->iid_par, ps->nr_iid_par, ps->num_env, 1);\n        remap20(&icc_mapped, ps->icc_par, ps->nr_icc_par, ps->num_env, 1);\n        if (ps->enable_ipdopd) {\n            remap20(&ipd_mapped, ps->ipd_par, ps->nr_ipdopd_par, ps->num_env, 0);\n            remap20(&opd_mapped, ps->opd_par, ps->nr_ipdopd_par, ps->num_env, 0);\n        }\n        if (ps->is34bands_old) {\n            map_val_34_to_20(H11[0][0]);\n            map_val_34_to_20(H11[1][0]);\n            map_val_34_to_20(H12[0][0]);\n            map_val_34_to_20(H12[1][0]);\n            map_val_34_to_20(H21[0][0]);\n            map_val_34_to_20(H21[1][0]);\n            map_val_34_to_20(H22[0][0]);\n            map_val_34_to_20(H22[1][0]);\n            ipdopd_reset(ipd_hist, opd_hist);\n        }\n    }\n    for (e = 0; e < ps->num_env; e++) {\n        for (b = 0; b < NR_PAR_BANDS[is34]; b++) {\n            float h11, h12, h21, h22;\n            h11 = H_LUT[iid_mapped[e][b] + 7 + 23 * ps->iid_quant][icc_mapped[e][b]][0];\n            h12 = H_LUT[iid_mapped[e][b] + 7 + 23 * ps->iid_quant][icc_mapped[e][b]][1];\n            h21 = H_LUT[iid_mapped[e][b] + 7 + 23 * ps->iid_quant][icc_mapped[e][b]][2];\n            h22 = H_LUT[iid_mapped[e][b] + 7 + 23 * ps->iid_quant][icc_mapped[e][b]][3];\n            if (!PS_BASELINE && ps->enable_ipdopd && b < ps->nr_ipdopd_par) {\n                float h11i, h12i, h21i, h22i;\n                float ipd_adj_re, ipd_adj_im;\n                int opd_idx = opd_hist[b] * 8 + opd_mapped[e][b];\n                int ipd_idx = ipd_hist[b] * 8 + ipd_mapped[e][b];\n                float opd_re = pd_re_smooth[opd_idx];\n                float opd_im = pd_im_smooth[opd_idx];\n                float ipd_re = pd_re_smooth[ipd_idx];\n                float ipd_im = pd_im_smooth[ipd_idx];\n                opd_hist[b] = opd_idx & 0x3F;\n                ipd_hist[b] = ipd_idx & 0x3F;\n                ipd_adj_re = opd_re*ipd_re + opd_im*ipd_im;\n                ipd_adj_im = opd_im*ipd_re - opd_re*ipd_im;\n                h11i = h11 * opd_im;\n                h11  = h11 * opd_re;\n                h12i = h12 * ipd_adj_im;\n                h12  = h12 * ipd_adj_re;\n                h21i = h21 * opd_im;\n                h21  = h21 * opd_re;\n                h22i = h22 * ipd_adj_im;\n                h22  = h22 * ipd_adj_re;\n                H11[1][e+1][b] = h11i;\n                H12[1][e+1][b] = h12i;\n                H21[1][e+1][b] = h21i;\n                H22[1][e+1][b] = h22i;\n            }\n            H11[0][e+1][b] = h11;\n            H12[0][e+1][b] = h12;\n            H21[0][e+1][b] = h21;\n            H22[0][e+1][b] = h22;\n        }\n        for (k = 0; k < NR_BANDS[is34]; k++) {\n            float h[2][4];\n            float h_step[2][4];\n            int start = ps->border_position[e];\n            int stop  = ps->border_position[e+1];\n            float width = 1.f / (stop - start);\n            b = k_to_i[k];\n            h[0][0] = H11[0][e][b];\n            h[0][1] = H12[0][e][b];\n            h[0][2] = H21[0][e][b];\n            h[0][3] = H22[0][e][b];\n            if (!PS_BASELINE && ps->enable_ipdopd) {\n            if ((is34 && k <= 13 && k >= 9) || (!is34 && k <= 1)) {\n                h[1][0] = -H11[1][e][b];\n                h[1][1] = -H12[1][e][b];\n                h[1][2] = -H21[1][e][b];\n                h[1][3] = -H22[1][e][b];\n            } else {\n                h[1][0] = H11[1][e][b];\n                h[1][1] = H12[1][e][b];\n                h[1][2] = H21[1][e][b];\n                h[1][3] = H22[1][e][b];\n            }\n            }\n            h_step[0][0] = (H11[0][e+1][b] - h[0][0]) * width;\n            h_step[0][1] = (H12[0][e+1][b] - h[0][1]) * width;\n            h_step[0][2] = (H21[0][e+1][b] - h[0][2]) * width;\n            h_step[0][3] = (H22[0][e+1][b] - h[0][3]) * width;\n            if (!PS_BASELINE && ps->enable_ipdopd) {\n                h_step[1][0] = (H11[1][e+1][b] - h[1][0]) * width;\n                h_step[1][1] = (H12[1][e+1][b] - h[1][1]) * width;\n                h_step[1][2] = (H21[1][e+1][b] - h[1][2]) * width;\n                h_step[1][3] = (H22[1][e+1][b] - h[1][3]) * width;\n            }\n            ps->dsp.stereo_interpolate[!PS_BASELINE && ps->enable_ipdopd](\n                l[k] + start + 1, r[k] + start + 1,\n                h, h_step, stop - start);\n        }\n    }\n}', 'static void remap20(int8_t (**p_par_mapped)[PS_MAX_NR_IIDICC],\n                    int8_t           (*par)[PS_MAX_NR_IIDICC],\n                    int num_par, int num_env, int full)\n{\n    int8_t (*par_mapped)[PS_MAX_NR_IIDICC] = *p_par_mapped;\n    int e;\n    if (num_par == 34 || num_par == 17) {\n        for (e = 0; e < num_env; e++) {\n            map_idx_34_to_20(par_mapped[e], par[e], full);\n        }\n    } else if (num_par == 10 || num_par == 5) {\n        for (e = 0; e < num_env; e++) {\n            map_idx_10_to_20(par_mapped[e], par[e], full);\n        }\n    } else {\n        *p_par_mapped = par;\n    }\n}', 'static void map_idx_34_to_20(int8_t *par_mapped, const int8_t *par, int full)\n{\n    par_mapped[ 0] = (2*par[ 0] +   par[ 1]) / 3;\n    par_mapped[ 1] = (  par[ 1] + 2*par[ 2]) / 3;\n    par_mapped[ 2] = (2*par[ 3] +   par[ 4]) / 3;\n    par_mapped[ 3] = (  par[ 4] + 2*par[ 5]) / 3;\n    par_mapped[ 4] = (  par[ 6] +   par[ 7]) / 2;\n    par_mapped[ 5] = (  par[ 8] +   par[ 9]) / 2;\n    par_mapped[ 6] =    par[10];\n    par_mapped[ 7] =    par[11];\n    par_mapped[ 8] = (  par[12] +   par[13]) / 2;\n    par_mapped[ 9] = (  par[14] +   par[15]) / 2;\n    par_mapped[10] =    par[16];\n    if (full) {\n        par_mapped[11] =    par[17];\n        par_mapped[12] =    par[18];\n        par_mapped[13] =    par[19];\n        par_mapped[14] = (  par[20] +   par[21]) / 2;\n        par_mapped[15] = (  par[22] +   par[23]) / 2;\n        par_mapped[16] = (  par[24] +   par[25]) / 2;\n        par_mapped[17] = (  par[26] +   par[27]) / 2;\n        par_mapped[18] = (  par[28] +   par[29] +   par[30] +   par[31]) / 4;\n        par_mapped[19] = (  par[32] +   par[33]) / 2;\n    }\n}']