libavcodec/aacsbr.c:754: error: Uninitialized Value
  The value read from bs_pointer was never initialized.

libavcodec/aacsbr.c:754:9: 
752.     ch_data->e_a[1] = -1;
753.     if ((ch_data->bs_frame_class & 1) && bs_pointer) { // FIXVAR or VARVAR and bs_pointer != 0
754.         ch_data->e_a[1] = ch_data->bs_num_env[1] + 1 - bs_pointer;
             ^
755.     } else if ((ch_data->bs_frame_class == 2) && (bs_pointer > 1)) // VARFIX and bs_pointer > 1
756.         ch_data->e_a[1] = bs_pointer - 1;

static int read_sbr_grid(AACContext *ac, SpectralBandReplication *sbr,
                         GetBitContext *gb, SBRData *ch_data)
{
    int i;
    unsigned bs_pointer;
    int abs_bord_lead = 0;
    int abs_bord_trail = 16;
    int num_rel_lead, num_rel_trail;
    uint8_t bs_rel_bord[2][3];
    ch_data->bs_freq_res[0] = ch_data->bs_freq_res[ch_data->bs_num_env[1]];
    ch_data->bs_num_env[0] = ch_data->bs_num_env[1];
    ch_data->bs_amp_res = sbr->bs_amp_res_header;
    switch (ch_data->bs_frame_class = get_bits(gb, 2)) {
    case FIXFIX:
        ch_data->bs_num_env[1] = 1 << get_bits(gb, 2);
        num_rel_lead           = ch_data->bs_num_env[1] - 1;
        if (ch_data->bs_num_env[1] == 1)
            ch_data->bs_amp_res = 0;
        if (ch_data->bs_num_env[1] > 4) {
            av_log(ac->avccontext, AV_LOG_ERROR,
                   "Invalid bitstream, too many SBR envelopes in FIXFIX type SBR frame: %d\n",
                   ch_data->bs_num_env[1]);
            return -1;
        }
        bs_pointer = 0;
        ch_data->bs_freq_res[1] = get_bits1(gb);
        for (i = 1; i < ch_data->bs_num_env[1]; i++)
            ch_data->bs_freq_res[i + 1] = ch_data->bs_freq_res[1];
        break;
    case FIXVAR:
        abs_bord_trail         += get_bits(gb, 2);
        num_rel_trail           = get_bits(gb, 2);
        num_rel_lead            = 0;
        ch_data->bs_num_env[1]  = num_rel_trail + 1;
        for (i = 0; i < num_rel_trail; i++)
            bs_rel_bord[1][i] = 2 * get_bits(gb, 2) + 2;
        bs_pointer = get_bits(gb, ceil_log2[ch_data->bs_num_env[1]]);
        for (i = 0; i < ch_data->bs_num_env[1]; i++)
            ch_data->bs_freq_res[ch_data->bs_num_env[1] - i] = get_bits1(gb);
        break;
    case VARFIX:
        abs_bord_lead           = get_bits(gb, 2);
        num_rel_lead            = get_bits(gb, 2);
        ch_data->bs_num_env[1]  = num_rel_lead + 1;
        for (i = 0; i < num_rel_lead; i++)
            bs_rel_bord[0][i] = 2 * get_bits(gb, 2) + 2;
        bs_pointer = get_bits(gb, ceil_log2[ch_data->bs_num_env[1]]);
        get_bits1_vector(gb, ch_data->bs_freq_res + 1, ch_data->bs_num_env[1]);
        break;
    case VARVAR:
        abs_bord_lead           = get_bits(gb, 2);
        abs_bord_trail         += get_bits(gb, 2);
        num_rel_lead            = get_bits(gb, 2);
        num_rel_trail           = get_bits(gb, 2);
        ch_data->bs_num_env[1]  = num_rel_lead + num_rel_trail + 1;
        if (ch_data->bs_num_env[1] > 5) {
            av_log(ac->avccontext, AV_LOG_ERROR,
                   "Invalid bitstream, too many SBR envelopes in VARVAR type SBR frame: %d\n",
                   ch_data->bs_num_env[1]);
            return -1;
        }
        for (i = 0; i < num_rel_lead; i++)
            bs_rel_bord[0][i] = 2 * get_bits(gb, 2) + 2;
        for (i = 0; i < num_rel_trail; i++)
            bs_rel_bord[1][i] = 2 * get_bits(gb, 2) + 2;
        bs_pointer = get_bits(gb, ceil_log2[ch_data->bs_num_env[1]]);
        get_bits1_vector(gb, ch_data->bs_freq_res + 1, ch_data->bs_num_env[1]);
        break;
    }
    if (bs_pointer > ch_data->bs_num_env[1] + 1) {
        av_log(ac->avccontext, AV_LOG_ERROR,
               "Invalid bitstream, bs_pointer points to a middle noise border outside the time borders table: %d\n",
               bs_pointer);
        return -1;
    }
    ch_data->t_env_num_env_old = ch_data->t_env[ch_data->bs_num_env[0]];
    ch_data->t_env[0]                      = abs_bord_lead;
    ch_data->t_env[ch_data->bs_num_env[1]] = abs_bord_trail;
    if (ch_data->bs_frame_class == FIXFIX) {
        int temp = (abs_bord_trail + (ch_data->bs_num_env[1] >> 1)) /
                   ch_data->bs_num_env[1];
        for (i = 0; i < num_rel_lead; i++)
            ch_data->t_env[i + 1] = ch_data->t_env[i] + temp;
    } else if (ch_data->bs_frame_class > 1) {
        for (i = 0; i < num_rel_lead; i++)
            ch_data->t_env[i + 1] = ch_data->t_env[i] + bs_rel_bord[0][i];
    }
    if (ch_data->bs_frame_class & 1) {
        for (i = ch_data->bs_num_env[1] - 1; i > num_rel_lead; i--)
            ch_data->t_env[i] = ch_data->t_env[i + 1] -
                                bs_rel_bord[1][ch_data->bs_num_env[1] - 1 - i];
    }
    ch_data->bs_num_noise = (ch_data->bs_num_env[1] > 1) + 1;
    ch_data->t_q[0] = ch_data->t_env[0];
    if (ch_data->bs_num_noise > 1) {
        unsigned int idx;
        if (ch_data->bs_frame_class == FIXFIX) {
            idx = ch_data->bs_num_env[1] >> 1;
        } else if (ch_data->bs_frame_class & 1) {
            idx = ch_data->bs_num_env[1] - FFMAX(bs_pointer - 1, 1);
        } else {
            if (!bs_pointer)
                idx = 1;
            else if (bs_pointer == 1)
                idx = ch_data->bs_num_env[1] - 1;
            else
                idx = bs_pointer - 1;
        }
        ch_data->t_q[1] = ch_data->t_env[idx];
        ch_data->t_q[2] = ch_data->t_env[ch_data->bs_num_env[1]];
    } else
        ch_data->t_q[1] = ch_data->t_env[ch_data->bs_num_env[1]];
    ch_data->e_a[0] = -(ch_data->e_a[1] != ch_data->bs_num_env[0]);
    ch_data->e_a[1] = -1;
    if ((ch_data->bs_frame_class & 1) && bs_pointer) {
        ch_data->e_a[1] = ch_data->bs_num_env[1] + 1 - bs_pointer;
    } else if ((ch_data->bs_frame_class == 2) && (bs_pointer > 1))
        ch_data->e_a[1] = bs_pointer - 1;
    return 0;
}
['static int read_sbr_grid(AACContext *ac, SpectralBandReplication *sbr,\n                         GetBitContext *gb, SBRData *ch_data)\n{\n    int i;\n    unsigned bs_pointer;\n    int abs_bord_lead = 0;\n    int abs_bord_trail = 16;\n    int num_rel_lead, num_rel_trail;\n    uint8_t bs_rel_bord[2][3];\n    ch_data->bs_freq_res[0] = ch_data->bs_freq_res[ch_data->bs_num_env[1]];\n    ch_data->bs_num_env[0] = ch_data->bs_num_env[1];\n    ch_data->bs_amp_res = sbr->bs_amp_res_header;\n    switch (ch_data->bs_frame_class = get_bits(gb, 2)) {\n    case FIXFIX:\n        ch_data->bs_num_env[1] = 1 << get_bits(gb, 2);\n        num_rel_lead           = ch_data->bs_num_env[1] - 1;\n        if (ch_data->bs_num_env[1] == 1)\n            ch_data->bs_amp_res = 0;\n        if (ch_data->bs_num_env[1] > 4) {\n            av_log(ac->avccontext, AV_LOG_ERROR,\n                   "Invalid bitstream, too many SBR envelopes in FIXFIX type SBR frame: %d\\n",\n                   ch_data->bs_num_env[1]);\n            return -1;\n        }\n        bs_pointer = 0;\n        ch_data->bs_freq_res[1] = get_bits1(gb);\n        for (i = 1; i < ch_data->bs_num_env[1]; i++)\n            ch_data->bs_freq_res[i + 1] = ch_data->bs_freq_res[1];\n        break;\n    case FIXVAR:\n        abs_bord_trail         += get_bits(gb, 2);\n        num_rel_trail           = get_bits(gb, 2);\n        num_rel_lead            = 0;\n        ch_data->bs_num_env[1]  = num_rel_trail + 1;\n        for (i = 0; i < num_rel_trail; i++)\n            bs_rel_bord[1][i] = 2 * get_bits(gb, 2) + 2;\n        bs_pointer = get_bits(gb, ceil_log2[ch_data->bs_num_env[1]]);\n        for (i = 0; i < ch_data->bs_num_env[1]; i++)\n            ch_data->bs_freq_res[ch_data->bs_num_env[1] - i] = get_bits1(gb);\n        break;\n    case VARFIX:\n        abs_bord_lead           = get_bits(gb, 2);\n        num_rel_lead            = get_bits(gb, 2);\n        ch_data->bs_num_env[1]  = num_rel_lead + 1;\n        for (i = 0; i < num_rel_lead; i++)\n            bs_rel_bord[0][i] = 2 * get_bits(gb, 2) + 2;\n        bs_pointer = get_bits(gb, ceil_log2[ch_data->bs_num_env[1]]);\n        get_bits1_vector(gb, ch_data->bs_freq_res + 1, ch_data->bs_num_env[1]);\n        break;\n    case VARVAR:\n        abs_bord_lead           = get_bits(gb, 2);\n        abs_bord_trail         += get_bits(gb, 2);\n        num_rel_lead            = get_bits(gb, 2);\n        num_rel_trail           = get_bits(gb, 2);\n        ch_data->bs_num_env[1]  = num_rel_lead + num_rel_trail + 1;\n        if (ch_data->bs_num_env[1] > 5) {\n            av_log(ac->avccontext, AV_LOG_ERROR,\n                   "Invalid bitstream, too many SBR envelopes in VARVAR type SBR frame: %d\\n",\n                   ch_data->bs_num_env[1]);\n            return -1;\n        }\n        for (i = 0; i < num_rel_lead; i++)\n            bs_rel_bord[0][i] = 2 * get_bits(gb, 2) + 2;\n        for (i = 0; i < num_rel_trail; i++)\n            bs_rel_bord[1][i] = 2 * get_bits(gb, 2) + 2;\n        bs_pointer = get_bits(gb, ceil_log2[ch_data->bs_num_env[1]]);\n        get_bits1_vector(gb, ch_data->bs_freq_res + 1, ch_data->bs_num_env[1]);\n        break;\n    }\n    if (bs_pointer > ch_data->bs_num_env[1] + 1) {\n        av_log(ac->avccontext, AV_LOG_ERROR,\n               "Invalid bitstream, bs_pointer points to a middle noise border outside the time borders table: %d\\n",\n               bs_pointer);\n        return -1;\n    }\n    ch_data->t_env_num_env_old = ch_data->t_env[ch_data->bs_num_env[0]];\n    ch_data->t_env[0]                      = abs_bord_lead;\n    ch_data->t_env[ch_data->bs_num_env[1]] = abs_bord_trail;\n    if (ch_data->bs_frame_class == FIXFIX) {\n        int temp = (abs_bord_trail + (ch_data->bs_num_env[1] >> 1)) /\n                   ch_data->bs_num_env[1];\n        for (i = 0; i < num_rel_lead; i++)\n            ch_data->t_env[i + 1] = ch_data->t_env[i] + temp;\n    } else if (ch_data->bs_frame_class > 1) {\n        for (i = 0; i < num_rel_lead; i++)\n            ch_data->t_env[i + 1] = ch_data->t_env[i] + bs_rel_bord[0][i];\n    }\n    if (ch_data->bs_frame_class & 1) {\n        for (i = ch_data->bs_num_env[1] - 1; i > num_rel_lead; i--)\n            ch_data->t_env[i] = ch_data->t_env[i + 1] -\n                                bs_rel_bord[1][ch_data->bs_num_env[1] - 1 - i];\n    }\n    ch_data->bs_num_noise = (ch_data->bs_num_env[1] > 1) + 1;\n    ch_data->t_q[0] = ch_data->t_env[0];\n    if (ch_data->bs_num_noise > 1) {\n        unsigned int idx;\n        if (ch_data->bs_frame_class == FIXFIX) {\n            idx = ch_data->bs_num_env[1] >> 1;\n        } else if (ch_data->bs_frame_class & 1) {\n            idx = ch_data->bs_num_env[1] - FFMAX(bs_pointer - 1, 1);\n        } else {\n            if (!bs_pointer)\n                idx = 1;\n            else if (bs_pointer == 1)\n                idx = ch_data->bs_num_env[1] - 1;\n            else\n                idx = bs_pointer - 1;\n        }\n        ch_data->t_q[1] = ch_data->t_env[idx];\n        ch_data->t_q[2] = ch_data->t_env[ch_data->bs_num_env[1]];\n    } else\n        ch_data->t_q[1] = ch_data->t_env[ch_data->bs_num_env[1]];\n    ch_data->e_a[0] = -(ch_data->e_a[1] != ch_data->bs_num_env[0]);\n    ch_data->e_a[1] = -1;\n    if ((ch_data->bs_frame_class & 1) && bs_pointer) {\n        ch_data->e_a[1] = ch_data->bs_num_env[1] + 1 - bs_pointer;\n    } else if ((ch_data->bs_frame_class == 2) && (bs_pointer > 1))\n        ch_data->e_a[1] = bs_pointer - 1;\n    return 0;\n}']