libavcodec/alsdec.c:661: error: Buffer Overrun L2
  Offset: [0, 4] Size: 4.

libavcodec/alsdec.c:661:49: <Offset trace>
659.             bd->ltp_gain[1]   = decode_rice(gb, 2) << 3;
660. 
661.             bd->ltp_gain[2]   = ltp_gain_values[get_unary(gb, 0, 4)][get_bits(gb, 2)];
                                                     ^
662. 
663.             bd->ltp_gain[3]   = decode_rice(gb, 2) << 3;

libavcodec/alsdec.c:661:49: Call
659.             bd->ltp_gain[1]   = decode_rice(gb, 2) << 3;
660. 
661.             bd->ltp_gain[2]   = ltp_gain_values[get_unary(gb, 0, 4)][get_bits(gb, 2)];
                                                     ^
662. 
663.             bd->ltp_gain[3]   = decode_rice(gb, 2) << 3;

libavcodec/unary.h:33:1: Parameter `len`
  31.  * @return Unary length/index
  32.  */
  33. static inline int get_unary(GetBitContext *gb, int stop, int len)
      ^
  34. {
  35.     int i;

libavcodec/unary.h:38:5: Assignment
  36. 
  37.     for(i = 0; i < len && get_bits1(gb) != stop; i++);
  38.     return i;
          ^
  39. }
  40. 

libavcodec/alsdec.c:104:1: <Length trace>
102.  *  To be indexed by the Rice coded indices.
103.  */
104. static const uint8_t ltp_gain_values [4][4] = {
     ^
105.     { 0,  8, 16,  24},
106.     {32, 40, 48,  56},

libavcodec/alsdec.c:104:1: Array declaration
102.  *  To be indexed by the Rice coded indices.
103.  */
104. static const uint8_t ltp_gain_values [4][4] = {
     ^
105.     { 0,  8, 16,  24},
106.     {32, 40, 48,  56},

libavcodec/alsdec.c:661:33: Array access: Offset: [0, 4] Size: 4
659.             bd->ltp_gain[1]   = decode_rice(gb, 2) << 3;
660. 
661.             bd->ltp_gain[2]   = ltp_gain_values[get_unary(gb, 0, 4)][get_bits(gb, 2)];
                                     ^
662. 
663.             bd->ltp_gain[3]   = decode_rice(gb, 2) << 3;

static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)
{
    ALSSpecificConfig *sconf = &ctx->sconf;
    AVCodecContext *avctx    = ctx->avctx;
    GetBitContext *gb        = &ctx->gb;
    unsigned int k;
    unsigned int s[8];
    unsigned int sub_blocks, log2_sub_blocks, sb_length;
    unsigned int start      = 0;
    unsigned int opt_order;
    int          sb;
    int32_t      *quant_cof = bd->quant_cof;
    bd->const_block = 0;
    bd->opt_order   = 1;
    bd->js_blocks   = get_bits1(gb);
    opt_order       = bd->opt_order;
    if (!sconf->bgmc && !sconf->sb_part) {
        log2_sub_blocks = 0;
    } else {
        if (sconf->bgmc && sconf->sb_part)
            log2_sub_blocks = get_bits(gb, 2);
        else
            log2_sub_blocks = 2 * get_bits1(gb);
    }
    sub_blocks = 1 << log2_sub_blocks;
    if (bd->block_length & (sub_blocks - 1)) {
        av_log(avctx, AV_LOG_WARNING,
               "Block length is not evenly divisible by the number of subblocks.\n");
        return -1;
    }
    sb_length = bd->block_length >> log2_sub_blocks;
    if (sconf->bgmc) {
    } else {
        s[0] = get_bits(gb, 4 + (sconf->resolution > 1));
        for (k = 1; k < sub_blocks; k++)
            s[k] = s[k - 1] + decode_rice(gb, 0);
    }
    if (get_bits1(gb))
        bd->shift_lsbs = get_bits(gb, 4) + 1;
    bd->store_prev_samples = (bd->js_blocks && bd->raw_other) || bd->shift_lsbs;
    if (!sconf->rlslms) {
        if (sconf->adapt_order) {
            int opt_order_length = av_ceil_log2(av_clip((bd->block_length >> 3) - 1,
                                                2, sconf->max_order + 1));
            bd->opt_order        = get_bits(gb, opt_order_length);
        } else {
            bd->opt_order = sconf->max_order;
        }
        opt_order = bd->opt_order;
        if (opt_order) {
            int add_base;
            if (sconf->coef_table == 3) {
                add_base = 0x7F;
                quant_cof[0] = 32 * parcor_scaled_values[get_bits(gb, 7)];
                if (opt_order > 1)
                    quant_cof[1] = -32 * parcor_scaled_values[get_bits(gb, 7)];
                for (k = 2; k < opt_order; k++)
                    quant_cof[k] = get_bits(gb, 7);
            } else {
                int k_max;
                add_base = 1;
                k_max = FFMIN(opt_order, 20);
                for (k = 0; k < k_max; k++) {
                    int rice_param = parcor_rice_table[sconf->coef_table][k][1];
                    int offset     = parcor_rice_table[sconf->coef_table][k][0];
                    quant_cof[k] = decode_rice(gb, rice_param) + offset;
                }
                k_max = FFMIN(opt_order, 127);
                for (; k < k_max; k++)
                    quant_cof[k] = decode_rice(gb, 2) + (k & 1);
                for (; k < opt_order; k++)
                    quant_cof[k] = decode_rice(gb, 1);
                quant_cof[0] = 32 * parcor_scaled_values[quant_cof[0] + 64];
                if (opt_order > 1)
                    quant_cof[1] = -32 * parcor_scaled_values[quant_cof[1] + 64];
            }
            for (k = 2; k < opt_order; k++)
                quant_cof[k] = (quant_cof[k] << 14) + (add_base << 13);
        }
    }
    if (sconf->long_term_prediction) {
        *bd->use_ltp = get_bits1(gb);
        if (*bd->use_ltp) {
            bd->ltp_gain[0]   = decode_rice(gb, 1) << 3;
            bd->ltp_gain[1]   = decode_rice(gb, 2) << 3;
            bd->ltp_gain[2]   = ltp_gain_values[get_unary(gb, 0, 4)][get_bits(gb, 2)];
            bd->ltp_gain[3]   = decode_rice(gb, 2) << 3;
            bd->ltp_gain[4]   = decode_rice(gb, 1) << 3;
            *bd->ltp_lag      = get_bits(gb, ctx->ltp_lag_length);
            *bd->ltp_lag     += FFMAX(4, opt_order + 1);
        }
    }
    if (bd->ra_block) {
        if (opt_order)
            bd->raw_samples[0] = decode_rice(gb, avctx->bits_per_raw_sample - 4);
        if (opt_order > 1)
            bd->raw_samples[1] = decode_rice(gb, s[0] + 3);
        if (opt_order > 2)
            bd->raw_samples[2] = decode_rice(gb, s[0] + 1);
        start = FFMIN(opt_order, 3);
    }
    if (sconf->bgmc) {
    } else {
        int32_t *current_res = bd->raw_samples + start;
        for (sb = 0; sb < sub_blocks; sb++, start = 0)
            for (; start < sb_length; start++)
                *current_res++ = decode_rice(gb, s[sb]);
     }
    if (!sconf->mc_coding || ctx->js_switch)
        align_get_bits(gb);
    return 0;
}
['static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd)\n{\n    ALSSpecificConfig *sconf = &ctx->sconf;\n    AVCodecContext *avctx    = ctx->avctx;\n    GetBitContext *gb        = &ctx->gb;\n    unsigned int k;\n    unsigned int s[8];\n    unsigned int sub_blocks, log2_sub_blocks, sb_length;\n    unsigned int start      = 0;\n    unsigned int opt_order;\n    int          sb;\n    int32_t      *quant_cof = bd->quant_cof;\n    bd->const_block = 0;\n    bd->opt_order   = 1;\n    bd->js_blocks   = get_bits1(gb);\n    opt_order       = bd->opt_order;\n    if (!sconf->bgmc && !sconf->sb_part) {\n        log2_sub_blocks = 0;\n    } else {\n        if (sconf->bgmc && sconf->sb_part)\n            log2_sub_blocks = get_bits(gb, 2);\n        else\n            log2_sub_blocks = 2 * get_bits1(gb);\n    }\n    sub_blocks = 1 << log2_sub_blocks;\n    if (bd->block_length & (sub_blocks - 1)) {\n        av_log(avctx, AV_LOG_WARNING,\n               "Block length is not evenly divisible by the number of subblocks.\\n");\n        return -1;\n    }\n    sb_length = bd->block_length >> log2_sub_blocks;\n    if (sconf->bgmc) {\n    } else {\n        s[0] = get_bits(gb, 4 + (sconf->resolution > 1));\n        for (k = 1; k < sub_blocks; k++)\n            s[k] = s[k - 1] + decode_rice(gb, 0);\n    }\n    if (get_bits1(gb))\n        bd->shift_lsbs = get_bits(gb, 4) + 1;\n    bd->store_prev_samples = (bd->js_blocks && bd->raw_other) || bd->shift_lsbs;\n    if (!sconf->rlslms) {\n        if (sconf->adapt_order) {\n            int opt_order_length = av_ceil_log2(av_clip((bd->block_length >> 3) - 1,\n                                                2, sconf->max_order + 1));\n            bd->opt_order        = get_bits(gb, opt_order_length);\n        } else {\n            bd->opt_order = sconf->max_order;\n        }\n        opt_order = bd->opt_order;\n        if (opt_order) {\n            int add_base;\n            if (sconf->coef_table == 3) {\n                add_base = 0x7F;\n                quant_cof[0] = 32 * parcor_scaled_values[get_bits(gb, 7)];\n                if (opt_order > 1)\n                    quant_cof[1] = -32 * parcor_scaled_values[get_bits(gb, 7)];\n                for (k = 2; k < opt_order; k++)\n                    quant_cof[k] = get_bits(gb, 7);\n            } else {\n                int k_max;\n                add_base = 1;\n                k_max = FFMIN(opt_order, 20);\n                for (k = 0; k < k_max; k++) {\n                    int rice_param = parcor_rice_table[sconf->coef_table][k][1];\n                    int offset     = parcor_rice_table[sconf->coef_table][k][0];\n                    quant_cof[k] = decode_rice(gb, rice_param) + offset;\n                }\n                k_max = FFMIN(opt_order, 127);\n                for (; k < k_max; k++)\n                    quant_cof[k] = decode_rice(gb, 2) + (k & 1);\n                for (; k < opt_order; k++)\n                    quant_cof[k] = decode_rice(gb, 1);\n                quant_cof[0] = 32 * parcor_scaled_values[quant_cof[0] + 64];\n                if (opt_order > 1)\n                    quant_cof[1] = -32 * parcor_scaled_values[quant_cof[1] + 64];\n            }\n            for (k = 2; k < opt_order; k++)\n                quant_cof[k] = (quant_cof[k] << 14) + (add_base << 13);\n        }\n    }\n    if (sconf->long_term_prediction) {\n        *bd->use_ltp = get_bits1(gb);\n        if (*bd->use_ltp) {\n            bd->ltp_gain[0]   = decode_rice(gb, 1) << 3;\n            bd->ltp_gain[1]   = decode_rice(gb, 2) << 3;\n            bd->ltp_gain[2]   = ltp_gain_values[get_unary(gb, 0, 4)][get_bits(gb, 2)];\n            bd->ltp_gain[3]   = decode_rice(gb, 2) << 3;\n            bd->ltp_gain[4]   = decode_rice(gb, 1) << 3;\n            *bd->ltp_lag      = get_bits(gb, ctx->ltp_lag_length);\n            *bd->ltp_lag     += FFMAX(4, opt_order + 1);\n        }\n    }\n    if (bd->ra_block) {\n        if (opt_order)\n            bd->raw_samples[0] = decode_rice(gb, avctx->bits_per_raw_sample - 4);\n        if (opt_order > 1)\n            bd->raw_samples[1] = decode_rice(gb, s[0] + 3);\n        if (opt_order > 2)\n            bd->raw_samples[2] = decode_rice(gb, s[0] + 1);\n        start = FFMIN(opt_order, 3);\n    }\n    if (sconf->bgmc) {\n    } else {\n        int32_t *current_res = bd->raw_samples + start;\n        for (sb = 0; sb < sub_blocks; sb++, start = 0)\n            for (; start < sb_length; start++)\n                *current_res++ = decode_rice(gb, s[sb]);\n     }\n    if (!sconf->mc_coding || ctx->js_switch)\n        align_get_bits(gb);\n    return 0;\n}', 'static inline int get_unary(GetBitContext *gb, int stop, int len)\n{\n    int i;\n    for(i = 0; i < len && get_bits1(gb) != stop; i++);\n    return i;\n}']