libavcodec/mpc7.c:74: error: Null Dereference
  pointer `&gb->buffer` last assigned on line 72 could be null and is dereferenced by call to `get_bits1()` at line 74, column 13.

libavcodec/mpc7.c:50:1: start of procedure mpc7_decode_init()
48. 
49. 
50. static av_cold int mpc7_decode_init(AVCodecContext * avctx)
    ^
51. {
52.     int i, j;

libavcodec/mpc7.c:53:5: 
51. {
52.     int i, j;
53.     MPCContext *c = avctx->priv_data;
        ^
54.     GetBitContext gb;
55.     uint8_t buf[16];

libavcodec/mpc7.c:56:5: 
54.     GetBitContext gb;
55.     uint8_t buf[16];
56.     static int vlc_initialized = 0;
        ^
57. 
58.     static VLC_TYPE scfi_table[1 << MPC7_SCFI_BITS][2];

libavcodec/mpc7.c:63:8: Taking false branch
61.     static VLC_TYPE quant_tables[7224][2];
62. 
63.     if(avctx->extradata_size < 16){
           ^
64.         av_log(avctx, AV_LOG_ERROR, "Too small extradata size (%i)!\n", avctx->extradata_size);
65.         return -1;

libavcodec/mpc7.c:67:5: 
65.         return -1;
66.     }
67.     memset(c->oldDSCF, 0, sizeof(c->oldDSCF));
        ^
68.     av_lfg_init(&c->rnd, 0xDEADBEEF);
69.     dsputil_init(&c->dsp, avctx);

libavcodec/mpc7.c:68:5: Skipping av_lfg_init(): empty list of specs
66.     }
67.     memset(c->oldDSCF, 0, sizeof(c->oldDSCF));
68.     av_lfg_init(&c->rnd, 0xDEADBEEF);
        ^
69.     dsputil_init(&c->dsp, avctx);
70.     c->dsp.bswap_buf((uint32_t*)buf, (const uint32_t*)avctx->extradata, 4);

libavcodec/mpc7.c:69:5: Skipping dsputil_init(): empty list of specs
67.     memset(c->oldDSCF, 0, sizeof(c->oldDSCF));
68.     av_lfg_init(&c->rnd, 0xDEADBEEF);
69.     dsputil_init(&c->dsp, avctx);
        ^
70.     c->dsp.bswap_buf((uint32_t*)buf, (const uint32_t*)avctx->extradata, 4);
71.     ff_mpc_init();

libavcodec/mpc7.c:70:5: Skipping __function_pointer__(): unresolved function pointer
68.     av_lfg_init(&c->rnd, 0xDEADBEEF);
69.     dsputil_init(&c->dsp, avctx);
70.     c->dsp.bswap_buf((uint32_t*)buf, (const uint32_t*)avctx->extradata, 4);
        ^
71.     ff_mpc_init();
72.     init_get_bits(&gb, buf, 128);

libavcodec/mpc7.c:71:5: 
69.     dsputil_init(&c->dsp, avctx);
70.     c->dsp.bswap_buf((uint32_t*)buf, (const uint32_t*)avctx->extradata, 4);
71.     ff_mpc_init();
        ^
72.     init_get_bits(&gb, buf, 128);
73. 

libavcodec/mpc.c:38:1: start of procedure ff_mpc_init()
  36. static DECLARE_ALIGNED_16(MPA_INT, mpa_window[512]);
  37. 
  38. void ff_mpc_init(void)
      ^
  39. {
  40.     ff_mpa_synth_init(mpa_window);

libavcodec/mpc.c:40:5: Skipping ff_mpa_synth_init(): empty list of specs
  38. void ff_mpc_init(void)
  39. {
  40.     ff_mpa_synth_init(mpa_window);
          ^
  41. }
  42. 

libavcodec/mpc.c:41:1: return from a call to ff_mpc_init
  39. {
  40.     ff_mpa_synth_init(mpa_window);
  41. }
      ^
  42. 
  43. /**

libavcodec/mpc7.c:72:5: 
70.     c->dsp.bswap_buf((uint32_t*)buf, (const uint32_t*)avctx->extradata, 4);
71.     ff_mpc_init();
72.     init_get_bits(&gb, buf, 128);
        ^
73. 
74.     c->IS = get_bits1(&gb);

libavcodec/get_bits.h:493:1: start of procedure init_get_bits()
  491.  * @param bit_size the size of the buffer in bits
  492.  */
  493. static inline void init_get_bits(GetBitContext *s,
       ^
  494.                    const uint8_t *buffer, int bit_size)
  495. {

libavcodec/get_bits.h:496:5: 
  494.                    const uint8_t *buffer, int bit_size)
  495. {
  496.     int buffer_size= (bit_size+7)>>3;
           ^
  497.     if(buffer_size < 0 || bit_size < 0) {
  498.         buffer_size = bit_size = 0;

libavcodec/get_bits.h:497:8: Taking true branch
  495. {
  496.     int buffer_size= (bit_size+7)>>3;
  497.     if(buffer_size < 0 || bit_size < 0) {
              ^
  498.         buffer_size = bit_size = 0;
  499.         buffer = NULL;

libavcodec/get_bits.h:498:9: 
  496.     int buffer_size= (bit_size+7)>>3;
  497.     if(buffer_size < 0 || bit_size < 0) {
  498.         buffer_size = bit_size = 0;
               ^
  499.         buffer = NULL;
  500.     }

libavcodec/get_bits.h:499:9: 
  497.     if(buffer_size < 0 || bit_size < 0) {
  498.         buffer_size = bit_size = 0;
  499.         buffer = NULL;
               ^
  500.     }
  501. 

libavcodec/get_bits.h:502:5: 
  500.     }
  501. 
  502.     s->buffer= buffer;
           ^
  503.     s->size_in_bits= bit_size;
  504.     s->buffer_end= buffer + buffer_size;

libavcodec/get_bits.h:503:5: 
  501. 
  502.     s->buffer= buffer;
  503.     s->size_in_bits= bit_size;
           ^
  504.     s->buffer_end= buffer + buffer_size;
  505. #ifdef ALT_BITSTREAM_READER

libavcodec/get_bits.h:504:5: 
  502.     s->buffer= buffer;
  503.     s->size_in_bits= bit_size;
  504.     s->buffer_end= buffer + buffer_size;
           ^
  505. #ifdef ALT_BITSTREAM_READER
  506.     s->index=0;

libavcodec/get_bits.h:506:5: 
  504.     s->buffer_end= buffer + buffer_size;
  505. #ifdef ALT_BITSTREAM_READER
  506.     s->index=0;
           ^
  507. #elif defined LIBMPEG2_BITSTREAM_READER
  508.     s->buffer_ptr = (uint8_t*)((intptr_t)buffer&(~1));

libavcodec/get_bits.h:516:1: return from a call to init_get_bits
  514.     skip_bits_long(s, 0);
  515. #endif
  516. }
       ^
  517. 
  518. static inline void align_get_bits(GetBitContext *s)

libavcodec/mpc7.c:74:5: 
72.     init_get_bits(&gb, buf, 128);
73. 
74.     c->IS = get_bits1(&gb);
        ^
75.     c->MSS = get_bits1(&gb);
76.     c->maxbands = get_bits(&gb, 6);

libavcodec/get_bits.h:416:1: start of procedure get_bits1()
  414. }
  415. 
  416. static inline unsigned int get_bits1(GetBitContext *s){
       ^
  417. #ifdef ALT_BITSTREAM_READER
  418.     int index= s->index;

libavcodec/get_bits.h:418:5: 
  416. static inline unsigned int get_bits1(GetBitContext *s){
  417. #ifdef ALT_BITSTREAM_READER
  418.     int index= s->index;
           ^
  419.     uint8_t result= s->buffer[ index>>3 ];
  420. #ifdef ALT_BITSTREAM_READER_LE

libavcodec/get_bits.h:419:5: 
  417. #ifdef ALT_BITSTREAM_READER
  418.     int index= s->index;
  419.     uint8_t result= s->buffer[ index>>3 ];
           ^
  420. #ifdef ALT_BITSTREAM_READER_LE
  421.     result>>= (index&0x07);

static av_cold int mpc7_decode_init(AVCodecContext * avctx)
{
    int i, j;
    MPCContext *c = avctx->priv_data;
    GetBitContext gb;
    uint8_t buf[16];
    static int vlc_initialized = 0;
    static VLC_TYPE scfi_table[1 << MPC7_SCFI_BITS][2];
    static VLC_TYPE dscf_table[1 << MPC7_DSCF_BITS][2];
    static VLC_TYPE hdr_table[1 << MPC7_HDR_BITS][2];
    static VLC_TYPE quant_tables[7224][2];
    if(avctx->extradata_size < 16){
        av_log(avctx, AV_LOG_ERROR, "Too small extradata size (%i)!\n", avctx->extradata_size);
        return -1;
    }
    memset(c->oldDSCF, 0, sizeof(c->oldDSCF));
    av_lfg_init(&c->rnd, 0xDEADBEEF);
    dsputil_init(&c->dsp, avctx);
    c->dsp.bswap_buf((uint32_t*)buf, (const uint32_t*)avctx->extradata, 4);
    ff_mpc_init();
    init_get_bits(&gb, buf, 128);
    c->IS = get_bits1(&gb);
    c->MSS = get_bits1(&gb);
    c->maxbands = get_bits(&gb, 6);
    if(c->maxbands >= BANDS){
        av_log(avctx, AV_LOG_ERROR, "Too many bands: %i\n", c->maxbands);
        return -1;
    }
    skip_bits(&gb, 88);
    c->gapless = get_bits1(&gb);
    c->lastframelen = get_bits(&gb, 11);
    av_log(avctx, AV_LOG_DEBUG, "IS: %d, MSS: %d, TG: %d, LFL: %d, bands: %d\n",
            c->IS, c->MSS, c->gapless, c->lastframelen, c->maxbands);
    c->frames_to_skip = 0;
    if(vlc_initialized) return 0;
    av_log(avctx, AV_LOG_DEBUG, "Initing VLC\n");
    scfi_vlc.table = scfi_table;
    scfi_vlc.table_allocated = 1 << MPC7_SCFI_BITS;
    if(init_vlc(&scfi_vlc, MPC7_SCFI_BITS, MPC7_SCFI_SIZE,
                &mpc7_scfi[1], 2, 1,
                &mpc7_scfi[0], 2, 1, INIT_VLC_USE_NEW_STATIC)){
        av_log(avctx, AV_LOG_ERROR, "Cannot init SCFI VLC\n");
        return -1;
    }
    dscf_vlc.table = dscf_table;
    dscf_vlc.table_allocated = 1 << MPC7_DSCF_BITS;
    if(init_vlc(&dscf_vlc, MPC7_DSCF_BITS, MPC7_DSCF_SIZE,
                &mpc7_dscf[1], 2, 1,
                &mpc7_dscf[0], 2, 1, INIT_VLC_USE_NEW_STATIC)){
        av_log(avctx, AV_LOG_ERROR, "Cannot init DSCF VLC\n");
        return -1;
    }
    hdr_vlc.table = hdr_table;
    hdr_vlc.table_allocated = 1 << MPC7_HDR_BITS;
    if(init_vlc(&hdr_vlc, MPC7_HDR_BITS, MPC7_HDR_SIZE,
                &mpc7_hdr[1], 2, 1,
                &mpc7_hdr[0], 2, 1, INIT_VLC_USE_NEW_STATIC)){
        av_log(avctx, AV_LOG_ERROR, "Cannot init HDR VLC\n");
        return -1;
    }
    for(i = 0; i < MPC7_QUANT_VLC_TABLES; i++){
        for(j = 0; j < 2; j++){
            quant_vlc[i][j].table = &quant_tables[quant_offsets[i*2 + j]];
            quant_vlc[i][j].table_allocated = quant_offsets[i*2 + j + 1] - quant_offsets[i*2 + j];
            if(init_vlc(&quant_vlc[i][j], 9, mpc7_quant_vlc_sizes[i],
                        &mpc7_quant_vlc[i][j][1], 4, 2,
                        &mpc7_quant_vlc[i][j][0], 4, 2, INIT_VLC_USE_NEW_STATIC)){
                av_log(avctx, AV_LOG_ERROR, "Cannot init QUANT VLC %i,%i\n",i,j);
                return -1;
            }
        }
    }
    vlc_initialized = 1;
    avctx->sample_fmt = SAMPLE_FMT_S16;
    avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO;
    return 0;
}
['static av_cold int mpc7_decode_init(AVCodecContext * avctx)\n{\n    int i, j;\n    MPCContext *c = avctx->priv_data;\n    GetBitContext gb;\n    uint8_t buf[16];\n    static int vlc_initialized = 0;\n    static VLC_TYPE scfi_table[1 << MPC7_SCFI_BITS][2];\n    static VLC_TYPE dscf_table[1 << MPC7_DSCF_BITS][2];\n    static VLC_TYPE hdr_table[1 << MPC7_HDR_BITS][2];\n    static VLC_TYPE quant_tables[7224][2];\n    if(avctx->extradata_size < 16){\n        av_log(avctx, AV_LOG_ERROR, "Too small extradata size (%i)!\\n", avctx->extradata_size);\n        return -1;\n    }\n    memset(c->oldDSCF, 0, sizeof(c->oldDSCF));\n    av_lfg_init(&c->rnd, 0xDEADBEEF);\n    dsputil_init(&c->dsp, avctx);\n    c->dsp.bswap_buf((uint32_t*)buf, (const uint32_t*)avctx->extradata, 4);\n    ff_mpc_init();\n    init_get_bits(&gb, buf, 128);\n    c->IS = get_bits1(&gb);\n    c->MSS = get_bits1(&gb);\n    c->maxbands = get_bits(&gb, 6);\n    if(c->maxbands >= BANDS){\n        av_log(avctx, AV_LOG_ERROR, "Too many bands: %i\\n", c->maxbands);\n        return -1;\n    }\n    skip_bits(&gb, 88);\n    c->gapless = get_bits1(&gb);\n    c->lastframelen = get_bits(&gb, 11);\n    av_log(avctx, AV_LOG_DEBUG, "IS: %d, MSS: %d, TG: %d, LFL: %d, bands: %d\\n",\n            c->IS, c->MSS, c->gapless, c->lastframelen, c->maxbands);\n    c->frames_to_skip = 0;\n    if(vlc_initialized) return 0;\n    av_log(avctx, AV_LOG_DEBUG, "Initing VLC\\n");\n    scfi_vlc.table = scfi_table;\n    scfi_vlc.table_allocated = 1 << MPC7_SCFI_BITS;\n    if(init_vlc(&scfi_vlc, MPC7_SCFI_BITS, MPC7_SCFI_SIZE,\n                &mpc7_scfi[1], 2, 1,\n                &mpc7_scfi[0], 2, 1, INIT_VLC_USE_NEW_STATIC)){\n        av_log(avctx, AV_LOG_ERROR, "Cannot init SCFI VLC\\n");\n        return -1;\n    }\n    dscf_vlc.table = dscf_table;\n    dscf_vlc.table_allocated = 1 << MPC7_DSCF_BITS;\n    if(init_vlc(&dscf_vlc, MPC7_DSCF_BITS, MPC7_DSCF_SIZE,\n                &mpc7_dscf[1], 2, 1,\n                &mpc7_dscf[0], 2, 1, INIT_VLC_USE_NEW_STATIC)){\n        av_log(avctx, AV_LOG_ERROR, "Cannot init DSCF VLC\\n");\n        return -1;\n    }\n    hdr_vlc.table = hdr_table;\n    hdr_vlc.table_allocated = 1 << MPC7_HDR_BITS;\n    if(init_vlc(&hdr_vlc, MPC7_HDR_BITS, MPC7_HDR_SIZE,\n                &mpc7_hdr[1], 2, 1,\n                &mpc7_hdr[0], 2, 1, INIT_VLC_USE_NEW_STATIC)){\n        av_log(avctx, AV_LOG_ERROR, "Cannot init HDR VLC\\n");\n        return -1;\n    }\n    for(i = 0; i < MPC7_QUANT_VLC_TABLES; i++){\n        for(j = 0; j < 2; j++){\n            quant_vlc[i][j].table = &quant_tables[quant_offsets[i*2 + j]];\n            quant_vlc[i][j].table_allocated = quant_offsets[i*2 + j + 1] - quant_offsets[i*2 + j];\n            if(init_vlc(&quant_vlc[i][j], 9, mpc7_quant_vlc_sizes[i],\n                        &mpc7_quant_vlc[i][j][1], 4, 2,\n                        &mpc7_quant_vlc[i][j][0], 4, 2, INIT_VLC_USE_NEW_STATIC)){\n                av_log(avctx, AV_LOG_ERROR, "Cannot init QUANT VLC %i,%i\\n",i,j);\n                return -1;\n            }\n        }\n    }\n    vlc_initialized = 1;\n    avctx->sample_fmt = SAMPLE_FMT_S16;\n    avctx->channel_layout = (avctx->channels==2) ? CH_LAYOUT_STEREO : CH_LAYOUT_MONO;\n    return 0;\n}', 'void ff_mpc_init(void)\n{\n    ff_mpa_synth_init(mpa_window);\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 unsigned int get_bits1(GetBitContext *s){\n#ifdef ALT_BITSTREAM_READER\n    int index= s->index;\n    uint8_t result= s->buffer[ index>>3 ];\n#ifdef ALT_BITSTREAM_READER_LE\n    result>>= (index&0x07);\n    result&= 1;\n#else\n    result<<= (index&0x07);\n    result>>= 8 - 1;\n#endif\n    index++;\n    s->index= index;\n    return result;\n#else\n    return get_bits(s, 1);\n#endif\n}']