libavcodec/twinvq.c:1091: error: Buffer Overrun L2
  Offset: [0, 3] Size: 3 by call to `construct_perm_table`.

libavcodec/twinvq.c:1090:10: Assignment
1088.     }
1089. 
1090.     for (frametype = FT_SHORT; frametype <= FT_PPC; frametype++)
               ^
1091.         construct_perm_table(tctx, frametype);
1092. }

libavcodec/twinvq.c:1091:9: Call
1089. 
1090.     for (frametype = FT_SHORT; frametype <= FT_PPC; frametype++)
1091.         construct_perm_table(tctx, frametype);
              ^
1092. }
1093. 

libavcodec/twinvq.c:999:1: <Offset trace>
 997. }
 998. 
 999. static av_cold void construct_perm_table(TwinContext *tctx,enum FrameType ftype)
      ^
1000. {
1001.     int block_size;

libavcodec/twinvq.c:999:1: Parameter `ftype`
   997. }
   998. 
   999. static av_cold void construct_perm_table(TwinContext *tctx,enum FrameType ftype)
        ^
  1000. {
  1001.     int block_size;

libavcodec/twinvq.c:999:1: <Length trace>
 997. }
 998. 
 999. static av_cold void construct_perm_table(TwinContext *tctx,enum FrameType ftype)
      ^
1000. {
1001.     int block_size;

libavcodec/twinvq.c:999:1: Parameter `tctx->mtab->fmode[*]`
   997. }
   998. 
   999. static av_cold void construct_perm_table(TwinContext *tctx,enum FrameType ftype)
        ^
  1000. {
  1001.     int block_size;

libavcodec/twinvq.c:1010:46: Array access: Offset: [0, 3] Size: 3 by call to `construct_perm_table` 
  1008.         block_size = mtab->ppc_shape_len;
  1009.     } else {
  1010.         size       = tctx->avctx->channels * mtab->fmode[ftype].sub;
                                                     ^
  1011.         block_size = mtab->size / mtab->fmode[ftype].sub;
  1012.     }

static av_cold void construct_perm_table(TwinContext *tctx,enum FrameType ftype)
{
    int block_size;
    const ModeTab *mtab = tctx->mtab;
    int size;
    int16_t *tmp_perm = (int16_t *) tctx->tmp_buf;
    if (ftype == FT_PPC) {
        size  = tctx->avctx->channels;
        block_size = mtab->ppc_shape_len;
    } else {
        size       = tctx->avctx->channels * mtab->fmode[ftype].sub;
        block_size = mtab->size / mtab->fmode[ftype].sub;
    }
    permutate_in_line(tmp_perm, tctx->n_div[ftype], size,
                      block_size, tctx->length[ftype],
                      tctx->length_change[ftype], ftype);
    transpose_perm(tctx->permut[ftype], tmp_perm, tctx->n_div[ftype],
                   tctx->length[ftype], tctx->length_change[ftype]);
    linear_perm(tctx->permut[ftype], tctx->permut[ftype], size,
                size*block_size);
}
['static av_cold void init_bitstream_params(TwinContext *tctx)\n{\n    const ModeTab *mtab = tctx->mtab;\n    int n_ch = tctx->avctx->channels;\n    int total_fr_bits = tctx->avctx->bit_rate*mtab->size/\n                             tctx->avctx->sample_rate;\n    int lsp_bits_per_block = n_ch*(mtab->lsp_bit0 + mtab->lsp_bit1 +\n                                   mtab->lsp_split*mtab->lsp_bit2);\n    int ppc_bits = n_ch*(mtab->pgain_bit + mtab->ppc_shape_bit +\n                         mtab->ppc_period_bit);\n    int bsize_no_main_cb[3];\n    int bse_bits[3];\n    int i;\n    enum FrameType frametype;\n    for (i = 0; i < 3; i++)\n        bse_bits[i] = n_ch *\n            (mtab->fmode[i].bark_n_coef * mtab->fmode[i].bark_n_bit + 1);\n    bsize_no_main_cb[2] = bse_bits[2] + lsp_bits_per_block + ppc_bits +\n                          WINDOW_TYPE_BITS + n_ch*GAIN_BITS;\n    for (i = 0; i < 2; i++)\n        bsize_no_main_cb[i] =\n            lsp_bits_per_block + n_ch*GAIN_BITS + WINDOW_TYPE_BITS +\n            mtab->fmode[i].sub*(bse_bits[i] + n_ch*SUB_GAIN_BITS);\n    for (i = 0; i < 4; i++) {\n        int bit_size;\n        int vect_size;\n        int rounded_up, rounded_down, num_rounded_down, num_rounded_up;\n        if (i == 3) {\n            bit_size  = n_ch * mtab->ppc_shape_bit;\n            vect_size = n_ch * mtab->ppc_shape_len;\n        } else {\n            bit_size = total_fr_bits - bsize_no_main_cb[i];\n            vect_size = n_ch * mtab->size;\n        }\n        tctx->n_div[i] = (bit_size + 13) / 14;\n        rounded_up   = (bit_size + tctx->n_div[i] - 1)/tctx->n_div[i];\n        rounded_down = (bit_size           )/tctx->n_div[i];\n        num_rounded_down = rounded_up * tctx->n_div[i] - bit_size;\n        num_rounded_up = tctx->n_div[i] - num_rounded_down;\n        tctx->bits_main_spec[0][i][0] = (rounded_up   + 1)/2;\n        tctx->bits_main_spec[1][i][0] = (rounded_up      )/2;\n        tctx->bits_main_spec[0][i][1] = (rounded_down + 1)/2;\n        tctx->bits_main_spec[1][i][1] = (rounded_down    )/2;\n        tctx->bits_main_spec_change[i] = num_rounded_up;\n        rounded_up   = (vect_size + tctx->n_div[i] - 1)/tctx->n_div[i];\n        rounded_down = (vect_size                     )/tctx->n_div[i];\n        num_rounded_down = rounded_up * tctx->n_div[i] - vect_size;\n        num_rounded_up = tctx->n_div[i] - num_rounded_down;\n        tctx->length[i][0] = rounded_up;\n        tctx->length[i][1] = rounded_down;\n        tctx->length_change[i] = num_rounded_up;\n    }\n    for (frametype = FT_SHORT; frametype <= FT_PPC; frametype++)\n        construct_perm_table(tctx, frametype);\n}', 'static av_cold void construct_perm_table(TwinContext *tctx,enum FrameType ftype)\n{\n    int block_size;\n    const ModeTab *mtab = tctx->mtab;\n    int size;\n    int16_t *tmp_perm = (int16_t *) tctx->tmp_buf;\n    if (ftype == FT_PPC) {\n        size  = tctx->avctx->channels;\n        block_size = mtab->ppc_shape_len;\n    } else {\n        size       = tctx->avctx->channels * mtab->fmode[ftype].sub;\n        block_size = mtab->size / mtab->fmode[ftype].sub;\n    }\n    permutate_in_line(tmp_perm, tctx->n_div[ftype], size,\n                      block_size, tctx->length[ftype],\n                      tctx->length_change[ftype], ftype);\n    transpose_perm(tctx->permut[ftype], tmp_perm, tctx->n_div[ftype],\n                   tctx->length[ftype], tctx->length_change[ftype]);\n    linear_perm(tctx->permut[ftype], tctx->permut[ftype], size,\n                size*block_size);\n}']