libavcodec/mpc8.c:203: error: Null Dereference
  pointer `gb->buffer` last assigned on line 202 could be null and is dereferenced by call to `skip_bits()` at line 203, column 5.

libavcodec/mpc8.c:184:1: start of procedure mpc8_decode_frame()
182. }
183. 
184. static int mpc8_decode_frame(AVCodecContext * avctx,
     ^
185.                             void *data, int *data_size,
186.                             const uint8_t * buf, int buf_size)

libavcodec/mpc8.c:188:5: 
186.                             const uint8_t * buf, int buf_size)
187. {
188.     MPCContext *c = avctx->priv_data;
         ^
189.     GetBitContext gb2, *gb = &gb2;
190.     int i, j, k, ch, cnt, res, t;

libavcodec/mpc8.c:189:5: 
187. {
188.     MPCContext *c = avctx->priv_data;
189.     GetBitContext gb2, *gb = &gb2;
         ^
190.     int i, j, k, ch, cnt, res, t;
191.     Band *bands = c->bands;

libavcodec/mpc8.c:191:5: 
189.     GetBitContext gb2, *gb = &gb2;
190.     int i, j, k, ch, cnt, res, t;
191.     Band *bands = c->bands;
         ^
192.     int off;
193.     int maxband, keyframe;

libavcodec/mpc8.c:196:16: Condition is true
194.     int last[2];
195. 
196.     keyframe = c->cur_frame == 0;
                    ^
197. 
198.     if(keyframe){

libavcodec/mpc8.c:196:5: 
194.     int last[2];
195. 
196.     keyframe = c->cur_frame == 0;
         ^
197. 
198.     if(keyframe){

libavcodec/mpc8.c:198:8: Taking true branch
196.     keyframe = c->cur_frame == 0;
197. 
198.     if(keyframe){
            ^
199.         memset(c->Q, 0, sizeof(c->Q));
200.         c->last_bits_used = 0;

libavcodec/mpc8.c:199:9: 
197. 
198.     if(keyframe){
199.         memset(c->Q, 0, sizeof(c->Q));
             ^
200.         c->last_bits_used = 0;
201.     }

libavcodec/mpc8.c:200:9: 
198.     if(keyframe){
199.         memset(c->Q, 0, sizeof(c->Q));
200.         c->last_bits_used = 0;
             ^
201.     }
202.     init_get_bits(gb, buf, buf_size * 8);

libavcodec/mpc8.c:202:5: 
200.         c->last_bits_used = 0;
201.     }
202.     init_get_bits(gb, buf, buf_size * 8);
         ^
203.     skip_bits(gb, c->last_bits_used & 7);
204. 

libavcodec/bitstream.h:719:1: start of procedure init_get_bits()
  717.  * @param bit_size the size of the buffer in bits
  718.  */
  719. static inline void init_get_bits(GetBitContext *s,
       ^
  720.                    const uint8_t *buffer, int bit_size)
  721. {

libavcodec/bitstream.h:722:5: 
  720.                    const uint8_t *buffer, int bit_size)
  721. {
  722.     int buffer_size= (bit_size+7)>>3;
           ^
  723.     if(buffer_size < 0 || bit_size < 0) {
  724.         buffer_size = bit_size = 0;

libavcodec/bitstream.h:723:8: Taking true branch
  721. {
  722.     int buffer_size= (bit_size+7)>>3;
  723.     if(buffer_size < 0 || bit_size < 0) {
              ^
  724.         buffer_size = bit_size = 0;
  725.         buffer = NULL;

libavcodec/bitstream.h:724:9: 
  722.     int buffer_size= (bit_size+7)>>3;
  723.     if(buffer_size < 0 || bit_size < 0) {
  724.         buffer_size = bit_size = 0;
               ^
  725.         buffer = NULL;
  726.     }

libavcodec/bitstream.h:725:9: 
  723.     if(buffer_size < 0 || bit_size < 0) {
  724.         buffer_size = bit_size = 0;
  725.         buffer = NULL;
               ^
  726.     }
  727. 

libavcodec/bitstream.h:728:5: 
  726.     }
  727. 
  728.     s->buffer= buffer;
           ^
  729.     s->size_in_bits= bit_size;
  730.     s->buffer_end= buffer + buffer_size;

libavcodec/bitstream.h:729:5: 
  727. 
  728.     s->buffer= buffer;
  729.     s->size_in_bits= bit_size;
           ^
  730.     s->buffer_end= buffer + buffer_size;
  731. #ifdef ALT_BITSTREAM_READER

libavcodec/bitstream.h:730:5: 
  728.     s->buffer= buffer;
  729.     s->size_in_bits= bit_size;
  730.     s->buffer_end= buffer + buffer_size;
           ^
  731. #ifdef ALT_BITSTREAM_READER
  732.     s->index=0;

libavcodec/bitstream.h:732:5: 
  730.     s->buffer_end= buffer + buffer_size;
  731. #ifdef ALT_BITSTREAM_READER
  732.     s->index=0;
           ^
  733. #elif defined LIBMPEG2_BITSTREAM_READER
  734.     s->buffer_ptr = (uint8_t*)((intptr_t)buffer&(~1));

libavcodec/bitstream.h:742:1: return from a call to init_get_bits
  740.     skip_bits_long(s, 0);
  741. #endif
  742. }
       ^
  743. 
  744. static inline void align_get_bits(GetBitContext *s)

libavcodec/mpc8.c:203:5: 
201.     }
202.     init_get_bits(gb, buf, buf_size * 8);
203.     skip_bits(gb, c->last_bits_used & 7);
         ^
204. 
205.     if(keyframe)

libavcodec/bitstream.h:639:1: start of procedure skip_bits()
  637. }
  638. 
  639. static inline void skip_bits(GetBitContext *s, int n){
       ^
  640.  //Note gcc seems to optimize this to s->index+=n for the ALT_READER :))
  641.     OPEN_READER(re, s)

libavcodec/bitstream.h:641:5: 
  639. static inline void skip_bits(GetBitContext *s, int n){
  640.  //Note gcc seems to optimize this to s->index+=n for the ALT_READER :))
  641.     OPEN_READER(re, s)
           ^
  642.     UPDATE_CACHE(re, s)
  643.     LAST_SKIP_BITS(re, s, n)

libavcodec/bitstream.h:642:5: 
  640.  //Note gcc seems to optimize this to s->index+=n for the ALT_READER :))
  641.     OPEN_READER(re, s)
  642.     UPDATE_CACHE(re, s)
           ^
  643.     LAST_SKIP_BITS(re, s, n)
  644.     CLOSE_READER(re, s)

static int mpc8_decode_frame(AVCodecContext * avctx,
                            void *data, int *data_size,
                            const uint8_t * buf, int buf_size)
{
    MPCContext *c = avctx->priv_data;
    GetBitContext gb2, *gb = &gb2;
    int i, j, k, ch, cnt, res, t;
    Band *bands = c->bands;
    int off;
    int maxband, keyframe;
    int last[2];
    keyframe = c->cur_frame == 0;
    if(keyframe){
        memset(c->Q, 0, sizeof(c->Q));
        c->last_bits_used = 0;
    }
    init_get_bits(gb, buf, buf_size * 8);
    skip_bits(gb, c->last_bits_used & 7);
    if(keyframe)
        maxband = mpc8_get_mod_golomb(gb, c->maxbands + 1);
    else{
        maxband = c->last_max_band + get_vlc2(gb, band_vlc.table, MPC8_BANDS_BITS, 2);
        if(maxband > 32) maxband -= 33;
    }
    c->last_max_band = maxband;
    if(maxband){
        last[0] = last[1] = 0;
        for(i = maxband - 1; i >= 0; i--){
            for(ch = 0; ch < 2; ch++){
                last[ch] = get_vlc2(gb, res_vlc[last[ch] > 2].table, MPC8_RES_BITS, 2) + last[ch];
                if(last[ch] > 15) last[ch] -= 17;
                bands[i].res[ch] = last[ch];
            }
        }
        if(c->MSS){
            int mask;
            cnt = 0;
            for(i = 0; i < maxband; i++)
                if(bands[i].res[0] || bands[i].res[1])
                    cnt++;
            t = mpc8_get_mod_golomb(gb, cnt);
            mask = mpc8_get_mask(gb, cnt, t);
            for(i = maxband - 1; i >= 0; i--)
                if(bands[i].res[0] || bands[i].res[1]){
                    bands[i].msf = mask & 1;
                    mask >>= 1;
                }
        }
    }
    for(i = maxband; i < c->maxbands; i++)
        bands[i].res[0] = bands[i].res[1] = 0;
    if(keyframe){
        for(i = 0; i < 32; i++)
            c->oldDSCF[0][i] = c->oldDSCF[1][i] = 1;
    }
    for(i = 0; i < maxband; i++){
        if(bands[i].res[0] || bands[i].res[1]){
            cnt = !!bands[i].res[0] + !!bands[i].res[1] - 1;
            if(cnt >= 0){
                t = get_vlc2(gb, scfi_vlc[cnt].table, scfi_vlc[cnt].bits, 1);
                if(bands[i].res[0]) bands[i].scfi[0] = t >> (2 * cnt);
                if(bands[i].res[1]) bands[i].scfi[1] = t & 3;
            }
        }
    }
    for(i = 0; i < maxband; i++){
        for(ch = 0; ch < 2; ch++){
            if(!bands[i].res[ch]) continue;
            if(c->oldDSCF[ch][i]){
                bands[i].scf_idx[ch][0] = get_bits(gb, 7) - 6;
                c->oldDSCF[ch][i] = 0;
            }else{
                t = get_vlc2(gb, dscf_vlc[1].table, MPC8_DSCF1_BITS, 2);
                if(t == 64)
                    t += get_bits(gb, 6);
                bands[i].scf_idx[ch][0] = ((bands[i].scf_idx[ch][2] + t - 25) & 0x7F) - 6;
            }
            for(j = 0; j < 2; j++){
                if((bands[i].scfi[ch] << j) & 2)
                    bands[i].scf_idx[ch][j + 1] = bands[i].scf_idx[ch][j];
                else{
                    t = get_vlc2(gb, dscf_vlc[0].table, MPC8_DSCF0_BITS, 2);
                    if(t == 31)
                        t = 64 + get_bits(gb, 6);
                    bands[i].scf_idx[ch][j + 1] = ((bands[i].scf_idx[ch][j] + t - 25) & 0x7F) - 6;
                }
            }
        }
    }
    for(i = 0, off = 0; i < maxband; i++, off += SAMPLES_PER_BAND){
        for(ch = 0; ch < 2; ch++){
            res = bands[i].res[ch];
            switch(res){
            case -1:
                for(j = 0; j < SAMPLES_PER_BAND; j++)
                    c->Q[ch][off + j] = (av_random(&c->rnd) & 0x3FC) - 510;
                break;
            case 0:
                break;
            case 1:
                for(j = 0; j < SAMPLES_PER_BAND; j += SAMPLES_PER_BAND / 2){
                    cnt = get_vlc2(gb, q1_vlc.table, MPC8_Q1_BITS, 2);
                    t = mpc8_get_mask(gb, 18, cnt);
                    for(k = 0; k < SAMPLES_PER_BAND / 2; k++, t <<= 1)
                        c->Q[ch][off + j + k] = (t & 0x20000) ? (get_bits1(gb) << 1) - 1 : 0;
                }
                break;
            case 2:
                cnt = 6;
                for(j = 0; j < SAMPLES_PER_BAND; j += 3){
                    t = get_vlc2(gb, q2_vlc[cnt > 3].table, MPC8_Q2_BITS, 2);
                    c->Q[ch][off + j + 0] = mpc8_idx50[t];
                    c->Q[ch][off + j + 1] = mpc8_idx51[t];
                    c->Q[ch][off + j + 2] = mpc8_idx52[t];
                    cnt = (cnt >> 1) + mpc8_huffq2[t];
                }
                break;
            case 3:
            case 4:
                for(j = 0; j < SAMPLES_PER_BAND; j += 2){
                    t = get_vlc2(gb, q3_vlc[res - 3].table, MPC8_Q3_BITS, 2) + q3_offsets[res - 3];
                    c->Q[ch][off + j + 1] = t >> 4;
                    c->Q[ch][off + j + 0] = (t & 8) ? (t & 0xF) - 16 : (t & 0xF);
                }
                break;
            case 5:
            case 6:
            case 7:
            case 8:
                cnt = 2 * mpc8_thres[res];
                for(j = 0; j < SAMPLES_PER_BAND; j++){
                    t = get_vlc2(gb, quant_vlc[res - 5][cnt > mpc8_thres[res]].table, quant_vlc[res - 5][cnt > mpc8_thres[res]].bits, 2) + quant_offsets[res - 5];
                    c->Q[ch][off + j] = t;
                    cnt = (cnt >> 1) + FFABS(c->Q[ch][off + j]);
                }
                break;
            default:
                for(j = 0; j < SAMPLES_PER_BAND; j++){
                    c->Q[ch][off + j] = get_vlc2(gb, q9up_vlc.table, MPC8_Q9UP_BITS, 2);
                    if(res != 9){
                        c->Q[ch][off + j] <<= res - 9;
                        c->Q[ch][off + j] |= get_bits(gb, res - 9);
                    }
                    c->Q[ch][off + j] -= (1 << (res - 2)) - 1;
                }
            }
        }
    }
    ff_mpc_dequantize_and_synth(c, maxband, data);
    c->cur_frame++;
    c->last_bits_used = get_bits_count(gb);
    if(c->cur_frame >= c->frames)
        c->cur_frame = 0;
    *data_size =  MPC_FRAME_SIZE * 4;
    return c->cur_frame ? c->last_bits_used >> 3 : buf_size;
}
['static int mpc8_decode_frame(AVCodecContext * avctx,\n                            void *data, int *data_size,\n                            const uint8_t * buf, int buf_size)\n{\n    MPCContext *c = avctx->priv_data;\n    GetBitContext gb2, *gb = &gb2;\n    int i, j, k, ch, cnt, res, t;\n    Band *bands = c->bands;\n    int off;\n    int maxband, keyframe;\n    int last[2];\n    keyframe = c->cur_frame == 0;\n    if(keyframe){\n        memset(c->Q, 0, sizeof(c->Q));\n        c->last_bits_used = 0;\n    }\n    init_get_bits(gb, buf, buf_size * 8);\n    skip_bits(gb, c->last_bits_used & 7);\n    if(keyframe)\n        maxband = mpc8_get_mod_golomb(gb, c->maxbands + 1);\n    else{\n        maxband = c->last_max_band + get_vlc2(gb, band_vlc.table, MPC8_BANDS_BITS, 2);\n        if(maxband > 32) maxband -= 33;\n    }\n    c->last_max_band = maxband;\n    if(maxband){\n        last[0] = last[1] = 0;\n        for(i = maxband - 1; i >= 0; i--){\n            for(ch = 0; ch < 2; ch++){\n                last[ch] = get_vlc2(gb, res_vlc[last[ch] > 2].table, MPC8_RES_BITS, 2) + last[ch];\n                if(last[ch] > 15) last[ch] -= 17;\n                bands[i].res[ch] = last[ch];\n            }\n        }\n        if(c->MSS){\n            int mask;\n            cnt = 0;\n            for(i = 0; i < maxband; i++)\n                if(bands[i].res[0] || bands[i].res[1])\n                    cnt++;\n            t = mpc8_get_mod_golomb(gb, cnt);\n            mask = mpc8_get_mask(gb, cnt, t);\n            for(i = maxband - 1; i >= 0; i--)\n                if(bands[i].res[0] || bands[i].res[1]){\n                    bands[i].msf = mask & 1;\n                    mask >>= 1;\n                }\n        }\n    }\n    for(i = maxband; i < c->maxbands; i++)\n        bands[i].res[0] = bands[i].res[1] = 0;\n    if(keyframe){\n        for(i = 0; i < 32; i++)\n            c->oldDSCF[0][i] = c->oldDSCF[1][i] = 1;\n    }\n    for(i = 0; i < maxband; i++){\n        if(bands[i].res[0] || bands[i].res[1]){\n            cnt = !!bands[i].res[0] + !!bands[i].res[1] - 1;\n            if(cnt >= 0){\n                t = get_vlc2(gb, scfi_vlc[cnt].table, scfi_vlc[cnt].bits, 1);\n                if(bands[i].res[0]) bands[i].scfi[0] = t >> (2 * cnt);\n                if(bands[i].res[1]) bands[i].scfi[1] = t & 3;\n            }\n        }\n    }\n    for(i = 0; i < maxband; i++){\n        for(ch = 0; ch < 2; ch++){\n            if(!bands[i].res[ch]) continue;\n            if(c->oldDSCF[ch][i]){\n                bands[i].scf_idx[ch][0] = get_bits(gb, 7) - 6;\n                c->oldDSCF[ch][i] = 0;\n            }else{\n                t = get_vlc2(gb, dscf_vlc[1].table, MPC8_DSCF1_BITS, 2);\n                if(t == 64)\n                    t += get_bits(gb, 6);\n                bands[i].scf_idx[ch][0] = ((bands[i].scf_idx[ch][2] + t - 25) & 0x7F) - 6;\n            }\n            for(j = 0; j < 2; j++){\n                if((bands[i].scfi[ch] << j) & 2)\n                    bands[i].scf_idx[ch][j + 1] = bands[i].scf_idx[ch][j];\n                else{\n                    t = get_vlc2(gb, dscf_vlc[0].table, MPC8_DSCF0_BITS, 2);\n                    if(t == 31)\n                        t = 64 + get_bits(gb, 6);\n                    bands[i].scf_idx[ch][j + 1] = ((bands[i].scf_idx[ch][j] + t - 25) & 0x7F) - 6;\n                }\n            }\n        }\n    }\n    for(i = 0, off = 0; i < maxband; i++, off += SAMPLES_PER_BAND){\n        for(ch = 0; ch < 2; ch++){\n            res = bands[i].res[ch];\n            switch(res){\n            case -1:\n                for(j = 0; j < SAMPLES_PER_BAND; j++)\n                    c->Q[ch][off + j] = (av_random(&c->rnd) & 0x3FC) - 510;\n                break;\n            case 0:\n                break;\n            case 1:\n                for(j = 0; j < SAMPLES_PER_BAND; j += SAMPLES_PER_BAND / 2){\n                    cnt = get_vlc2(gb, q1_vlc.table, MPC8_Q1_BITS, 2);\n                    t = mpc8_get_mask(gb, 18, cnt);\n                    for(k = 0; k < SAMPLES_PER_BAND / 2; k++, t <<= 1)\n                        c->Q[ch][off + j + k] = (t & 0x20000) ? (get_bits1(gb) << 1) - 1 : 0;\n                }\n                break;\n            case 2:\n                cnt = 6;\n                for(j = 0; j < SAMPLES_PER_BAND; j += 3){\n                    t = get_vlc2(gb, q2_vlc[cnt > 3].table, MPC8_Q2_BITS, 2);\n                    c->Q[ch][off + j + 0] = mpc8_idx50[t];\n                    c->Q[ch][off + j + 1] = mpc8_idx51[t];\n                    c->Q[ch][off + j + 2] = mpc8_idx52[t];\n                    cnt = (cnt >> 1) + mpc8_huffq2[t];\n                }\n                break;\n            case 3:\n            case 4:\n                for(j = 0; j < SAMPLES_PER_BAND; j += 2){\n                    t = get_vlc2(gb, q3_vlc[res - 3].table, MPC8_Q3_BITS, 2) + q3_offsets[res - 3];\n                    c->Q[ch][off + j + 1] = t >> 4;\n                    c->Q[ch][off + j + 0] = (t & 8) ? (t & 0xF) - 16 : (t & 0xF);\n                }\n                break;\n            case 5:\n            case 6:\n            case 7:\n            case 8:\n                cnt = 2 * mpc8_thres[res];\n                for(j = 0; j < SAMPLES_PER_BAND; j++){\n                    t = get_vlc2(gb, quant_vlc[res - 5][cnt > mpc8_thres[res]].table, quant_vlc[res - 5][cnt > mpc8_thres[res]].bits, 2) + quant_offsets[res - 5];\n                    c->Q[ch][off + j] = t;\n                    cnt = (cnt >> 1) + FFABS(c->Q[ch][off + j]);\n                }\n                break;\n            default:\n                for(j = 0; j < SAMPLES_PER_BAND; j++){\n                    c->Q[ch][off + j] = get_vlc2(gb, q9up_vlc.table, MPC8_Q9UP_BITS, 2);\n                    if(res != 9){\n                        c->Q[ch][off + j] <<= res - 9;\n                        c->Q[ch][off + j] |= get_bits(gb, res - 9);\n                    }\n                    c->Q[ch][off + j] -= (1 << (res - 2)) - 1;\n                }\n            }\n        }\n    }\n    ff_mpc_dequantize_and_synth(c, maxband, data);\n    c->cur_frame++;\n    c->last_bits_used = get_bits_count(gb);\n    if(c->cur_frame >= c->frames)\n        c->cur_frame = 0;\n    *data_size =  MPC_FRAME_SIZE * 4;\n    return c->cur_frame ? c->last_bits_used >> 3 : buf_size;\n}', 'static inline void init_get_bits(GetBitContext *s,\n                   const uint8_t *buffer, int bit_size)\n{\n    int buffer_size= (bit_size+7)>>3;\n    if(buffer_size < 0 || bit_size < 0) {\n        buffer_size = bit_size = 0;\n        buffer = NULL;\n    }\n    s->buffer= buffer;\n    s->size_in_bits= bit_size;\n    s->buffer_end= buffer + buffer_size;\n#ifdef ALT_BITSTREAM_READER\n    s->index=0;\n#elif defined LIBMPEG2_BITSTREAM_READER\n    s->buffer_ptr = (uint8_t*)((intptr_t)buffer&(~1));\n    s->bit_count = 16 + 8*((intptr_t)buffer&1);\n    skip_bits_long(s, 0);\n#elif defined A32_BITSTREAM_READER\n    s->buffer_ptr = (uint32_t*)((intptr_t)buffer&(~3));\n    s->bit_count = 32 + 8*((intptr_t)buffer&3);\n    skip_bits_long(s, 0);\n#endif\n}', 'static inline void skip_bits(GetBitContext *s, int n){\n    OPEN_READER(re, s)\n    UPDATE_CACHE(re, s)\n    LAST_SKIP_BITS(re, s, n)\n    CLOSE_READER(re, s)\n}']