libavcodec/ac3enc.c:1090: error: Buffer Overrun L3
  Offset: [-1, 4] Size: 6.

libavcodec/ac3enc.c:1076:10: <Offset trace>
1074.     reset_block_bap(s);
1075.     mantissa_bits = 0;
1076.     for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) {
               ^
1077.         AC3Block *block = &s->blocks[blk];
1078.         // initialize grouped mantissa counts. these are set so that they are

libavcodec/ac3enc.c:1076:10: Assignment
1074.     reset_block_bap(s);
1075.     mantissa_bits = 0;
1076.     for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) {
               ^
1077.         AC3Block *block = &s->blocks[blk];
1078.         // initialize grouped mantissa counts. these are set so that they are

libavcodec/ac3enc.c:1066:1: <Length trace>
1064.  *         is used.
1065.  */
1066. static int bit_alloc(AC3EncodeContext *s, int snr_offset)
      ^
1067. {
1068.     int blk, ch;

libavcodec/ac3enc.c:1066:1: Parameter `s->blocks[*]`
1064.  *         is used.
1065.  */
1066. static int bit_alloc(AC3EncodeContext *s, int snr_offset)
      ^
1067. {
1068.     int blk, ch;

libavcodec/ac3enc.c:1090:40: Array access: Offset: [-1, 4] Size: 6
1088.                whenever we reuse exponents. */
1089.             if (block->exp_strategy[ch] == EXP_REUSE) {
1090.                 memcpy(block->bap[ch], s->blocks[blk-1].bap[ch], AC3_MAX_COEFS);
                                             ^
1091.             } else {
1092.                 ff_ac3_bit_alloc_calc_bap(block->mask[ch], block->psd[ch], 0,

static int bit_alloc(AC3EncodeContext *s, int snr_offset)
{
    int blk, ch;
    int mantissa_bits;
    int mant_cnt[5];
    snr_offset = (snr_offset - 240) << 2;
    reset_block_bap(s);
    mantissa_bits = 0;
    for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) {
        AC3Block *block = &s->blocks[blk];
        mant_cnt[0] = mant_cnt[3] = 0;
        mant_cnt[1] = mant_cnt[2] = 2;
        mant_cnt[4] = 1;
        for (ch = 0; ch < s->channels; ch++) {
            if (block->exp_strategy[ch] == EXP_REUSE) {
                memcpy(block->bap[ch], s->blocks[blk-1].bap[ch], AC3_MAX_COEFS);
            } else {
                ff_ac3_bit_alloc_calc_bap(block->mask[ch], block->psd[ch], 0,
                                          s->nb_coefs[ch], snr_offset,
                                          s->bit_alloc.floor, ff_ac3_bap_tab,
                                          block->bap[ch]);
            }
            mantissa_bits += compute_mantissa_size(mant_cnt, block->bap[ch], s->nb_coefs[ch]);
        }
        mantissa_bits += compute_mantissa_size_final(mant_cnt);
    }
    return mantissa_bits;
}
['static int bit_alloc(AC3EncodeContext *s, int snr_offset)\n{\n    int blk, ch;\n    int mantissa_bits;\n    int mant_cnt[5];\n    snr_offset = (snr_offset - 240) << 2;\n    reset_block_bap(s);\n    mantissa_bits = 0;\n    for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) {\n        AC3Block *block = &s->blocks[blk];\n        mant_cnt[0] = mant_cnt[3] = 0;\n        mant_cnt[1] = mant_cnt[2] = 2;\n        mant_cnt[4] = 1;\n        for (ch = 0; ch < s->channels; ch++) {\n            if (block->exp_strategy[ch] == EXP_REUSE) {\n                memcpy(block->bap[ch], s->blocks[blk-1].bap[ch], AC3_MAX_COEFS);\n            } else {\n                ff_ac3_bit_alloc_calc_bap(block->mask[ch], block->psd[ch], 0,\n                                          s->nb_coefs[ch], snr_offset,\n                                          s->bit_alloc.floor, ff_ac3_bap_tab,\n                                          block->bap[ch]);\n            }\n            mantissa_bits += compute_mantissa_size(mant_cnt, block->bap[ch], s->nb_coefs[ch]);\n        }\n        mantissa_bits += compute_mantissa_size_final(mant_cnt);\n    }\n    return mantissa_bits;\n}']