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

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

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

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

libavcodec/mpc7.c:65:9: Taking false branch
63. 
64.     /* Musepack SV7 is always stereo */
65.     if (avctx->channels != 2) {
            ^
66.         av_log_ask_for_sample(avctx, "Unsupported number of channels: %d\n",
67.                               avctx->channels);

libavcodec/mpc7.c:71:8: Taking false branch
69.     }
70. 
71.     if(avctx->extradata_size < 16){
           ^
72.         av_log(avctx, AV_LOG_ERROR, "Too small extradata size (%i)!\n", avctx->extradata_size);
73.         return -1;

libavcodec/mpc7.c:75:5: 
73.         return -1;
74.     }
75.     memset(c->oldDSCF, 0, sizeof(c->oldDSCF));
        ^
76.     av_lfg_init(&c->rnd, 0xDEADBEEF);
77.     dsputil_init(&c->dsp, avctx);

libavcodec/mpc7.c:76:5: Skipping av_lfg_init(): empty list of specs
74.     }
75.     memset(c->oldDSCF, 0, sizeof(c->oldDSCF));
76.     av_lfg_init(&c->rnd, 0xDEADBEEF);
        ^
77.     dsputil_init(&c->dsp, avctx);
78.     ff_mpadsp_init(&c->mpadsp);

libavcodec/mpc7.c:77:5: Skipping dsputil_init(): empty list of specs
75.     memset(c->oldDSCF, 0, sizeof(c->oldDSCF));
76.     av_lfg_init(&c->rnd, 0xDEADBEEF);
77.     dsputil_init(&c->dsp, avctx);
        ^
78.     ff_mpadsp_init(&c->mpadsp);
79.     c->dsp.bswap_buf((uint32_t*)buf, (const uint32_t*)avctx->extradata, 4);

libavcodec/mpc7.c:78:5: 
76.     av_lfg_init(&c->rnd, 0xDEADBEEF);
77.     dsputil_init(&c->dsp, avctx);
78.     ff_mpadsp_init(&c->mpadsp);
        ^
79.     c->dsp.bswap_buf((uint32_t*)buf, (const uint32_t*)avctx->extradata, 4);
80.     ff_mpc_init();

libavcodec/mpegaudiodsp.c:26:1: start of procedure ff_mpadsp_init()
  24. #include "dct32.h"
  25. 
  26. void ff_mpadsp_init(MPADSPContext *s)
      ^
  27. {
  28.     DCTContext dct;

libavcodec/mpegaudiodsp.c:30:5: Skipping ff_dct_init(): empty list of specs
  28.     DCTContext dct;
  29. 
  30.     ff_dct_init(&dct, 5, DCT_II);
          ^
  31. 
  32.     s->apply_window_float = ff_mpadsp_apply_window_float;

libavcodec/mpegaudiodsp.c:32:5: 
  30.     ff_dct_init(&dct, 5, DCT_II);
  31. 
  32.     s->apply_window_float = ff_mpadsp_apply_window_float;
          ^
  33.     s->apply_window_fixed = ff_mpadsp_apply_window_fixed;
  34. 

libavcodec/mpegaudiodsp.c:33:5: 
  31. 
  32.     s->apply_window_float = ff_mpadsp_apply_window_float;
  33.     s->apply_window_fixed = ff_mpadsp_apply_window_fixed;
          ^
  34. 
  35.     s->dct32_float = dct.dct32;

libavcodec/mpegaudiodsp.c:35:5: 
  33.     s->apply_window_fixed = ff_mpadsp_apply_window_fixed;
  34. 
  35.     s->dct32_float = dct.dct32;
          ^
  36.     s->dct32_fixed = ff_dct32_fixed;
  37. 

libavcodec/mpegaudiodsp.c:36:5: 
  34. 
  35.     s->dct32_float = dct.dct32;
  36.     s->dct32_fixed = ff_dct32_fixed;
          ^
  37. 
  38.     if (ARCH_ARM)     ff_mpadsp_init_arm(s);

libavcodec/mpegaudiodsp.c:38:9: Taking false branch
  36.     s->dct32_fixed = ff_dct32_fixed;
  37. 
  38.     if (ARCH_ARM)     ff_mpadsp_init_arm(s);
              ^
  39.     if (HAVE_MMX)     ff_mpadsp_init_mmx(s);
  40.     if (HAVE_ALTIVEC) ff_mpadsp_init_altivec(s);

libavcodec/mpegaudiodsp.c:39:9: Taking false branch
  37. 
  38.     if (ARCH_ARM)     ff_mpadsp_init_arm(s);
  39.     if (HAVE_MMX)     ff_mpadsp_init_mmx(s);
              ^
  40.     if (HAVE_ALTIVEC) ff_mpadsp_init_altivec(s);
  41. }

libavcodec/mpegaudiodsp.c:40:9: Taking false branch
  38.     if (ARCH_ARM)     ff_mpadsp_init_arm(s);
  39.     if (HAVE_MMX)     ff_mpadsp_init_mmx(s);
  40.     if (HAVE_ALTIVEC) ff_mpadsp_init_altivec(s);
              ^
  41. }

libavcodec/mpegaudiodsp.c:40:5: 
  38.     if (ARCH_ARM)     ff_mpadsp_init_arm(s);
  39.     if (HAVE_MMX)     ff_mpadsp_init_mmx(s);
  40.     if (HAVE_ALTIVEC) ff_mpadsp_init_altivec(s);
          ^
  41. }

libavcodec/mpegaudiodsp.c:41:1: return from a call to ff_mpadsp_init
  39.     if (HAVE_MMX)     ff_mpadsp_init_mmx(s);
  40.     if (HAVE_ALTIVEC) ff_mpadsp_init_altivec(s);
  41. }
      ^

libavcodec/mpc7.c:79:5: Skipping __function_pointer__(): unresolved function pointer
77.     dsputil_init(&c->dsp, avctx);
78.     ff_mpadsp_init(&c->mpadsp);
79.     c->dsp.bswap_buf((uint32_t*)buf, (const uint32_t*)avctx->extradata, 4);
        ^
80.     ff_mpc_init();
81.     init_get_bits(&gb, buf, 128);

libavcodec/mpc7.c:80:5: 
78.     ff_mpadsp_init(&c->mpadsp);
79.     c->dsp.bswap_buf((uint32_t*)buf, (const uint32_t*)avctx->extradata, 4);
80.     ff_mpc_init();
        ^
81.     init_get_bits(&gb, buf, 128);
82. 

libavcodec/mpc.c:38:1: start of procedure ff_mpc_init()
  36. #include "mpcdata.h"
  37. 
  38. void ff_mpc_init(void)
      ^
  39. {
  40.     ff_mpa_synth_init_fixed(ff_mpa_synth_window_fixed);

libavcodec/mpc.c:40:5: Skipping ff_mpa_synth_init_fixed(): method has no implementation
  38. void ff_mpc_init(void)
  39. {
  40.     ff_mpa_synth_init_fixed(ff_mpa_synth_window_fixed);
          ^
  41. }
  42. 

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

libavcodec/mpc7.c:81:5: 
79.     c->dsp.bswap_buf((uint32_t*)buf, (const uint32_t*)avctx->extradata, 4);
80.     ff_mpc_init();
81.     init_get_bits(&gb, buf, 128);
        ^
82. 
83.     c->IS = get_bits1(&gb);

libavcodec/get_bits.h:383:1: start of procedure init_get_bits()
  381.  * responsible for checking for the buffer end yourself (take advantage of the padding)!
  382.  */
  383. static inline void init_get_bits(GetBitContext *s,
       ^
  384.                    const uint8_t *buffer, int bit_size)
  385. {

libavcodec/get_bits.h:386:5: 
  384.                    const uint8_t *buffer, int bit_size)
  385. {
  386.     int buffer_size = (bit_size+7)>>3;
           ^
  387.     if (buffer_size < 0 || bit_size < 0) {
  388.         buffer_size = bit_size = 0;

libavcodec/get_bits.h:387:9: Taking true branch
  385. {
  386.     int buffer_size = (bit_size+7)>>3;
  387.     if (buffer_size < 0 || bit_size < 0) {
               ^
  388.         buffer_size = bit_size = 0;
  389.         buffer = NULL;

libavcodec/get_bits.h:388:9: 
  386.     int buffer_size = (bit_size+7)>>3;
  387.     if (buffer_size < 0 || bit_size < 0) {
  388.         buffer_size = bit_size = 0;
               ^
  389.         buffer = NULL;
  390.     }

libavcodec/get_bits.h:389:9: 
  387.     if (buffer_size < 0 || bit_size < 0) {
  388.         buffer_size = bit_size = 0;
  389.         buffer = NULL;
               ^
  390.     }
  391. 

libavcodec/get_bits.h:392:5: 
  390.     }
  391. 
  392.     s->buffer       = buffer;
           ^
  393.     s->size_in_bits = bit_size;
  394.     s->buffer_end   = buffer + buffer_size;

libavcodec/get_bits.h:393:5: 
  391. 
  392.     s->buffer       = buffer;
  393.     s->size_in_bits = bit_size;
           ^
  394.     s->buffer_end   = buffer + buffer_size;
  395. #ifdef ALT_BITSTREAM_READER

libavcodec/get_bits.h:394:5: 
  392.     s->buffer       = buffer;
  393.     s->size_in_bits = bit_size;
  394.     s->buffer_end   = buffer + buffer_size;
           ^
  395. #ifdef ALT_BITSTREAM_READER
  396.     s->index        = 0;

libavcodec/get_bits.h:396:5: 
  394.     s->buffer_end   = buffer + buffer_size;
  395. #ifdef ALT_BITSTREAM_READER
  396.     s->index        = 0;
           ^
  397. #elif defined A32_BITSTREAM_READER
  398.     s->buffer_ptr   = (uint32_t*)((intptr_t)buffer & ~3);

libavcodec/get_bits.h:402:1: return from a call to init_get_bits
  400.     skip_bits_long(s, 0);
  401. #endif
  402. }
       ^
  403. 
  404. static inline void align_get_bits(GetBitContext *s)

libavcodec/mpc7.c:83:5: 
81.     init_get_bits(&gb, buf, 128);
82. 
83.     c->IS = get_bits1(&gb);
        ^
84.     c->MSS = get_bits1(&gb);
85.     c->maxbands = get_bits(&gb, 6);

libavcodec/get_bits.h:303:1: start of procedure get_bits1()
  301. }
  302. 
  303. static inline unsigned int get_bits1(GetBitContext *s){
       ^
  304. #ifdef ALT_BITSTREAM_READER
  305.     unsigned int index = s->index;

libavcodec/get_bits.h:305:5: 
  303. static inline unsigned int get_bits1(GetBitContext *s){
  304. #ifdef ALT_BITSTREAM_READER
  305.     unsigned int index = s->index;
           ^
  306.     uint8_t result = s->buffer[index>>3];
  307. #ifdef ALT_BITSTREAM_READER_LE

libavcodec/get_bits.h:306:5: 
  304. #ifdef ALT_BITSTREAM_READER
  305.     unsigned int index = s->index;
  306.     uint8_t result = s->buffer[index>>3];
           ^
  307. #ifdef ALT_BITSTREAM_READER_LE
  308.     result >>= index & 7;

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->channels != 2) {
        av_log_ask_for_sample(avctx, "Unsupported number of channels: %d\n",
                              avctx->channels);
        return AVERROR_PATCHWELCOME;
    }
    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);
    ff_mpadsp_init(&c->mpadsp);
    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_long(&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;
    avctx->sample_fmt = AV_SAMPLE_FMT_S16;
    avctx->channel_layout = AV_CH_LAYOUT_STEREO;
    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;
    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->channels != 2) {\n        av_log_ask_for_sample(avctx, "Unsupported number of channels: %d\\n",\n                              avctx->channels);\n        return AVERROR_PATCHWELCOME;\n    }\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    ff_mpadsp_init(&c->mpadsp);\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_long(&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    avctx->sample_fmt = AV_SAMPLE_FMT_S16;\n    avctx->channel_layout = AV_CH_LAYOUT_STEREO;\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    return 0;\n}', 'void ff_mpadsp_init(MPADSPContext *s)\n{\n    DCTContext dct;\n    ff_dct_init(&dct, 5, DCT_II);\n    s->apply_window_float = ff_mpadsp_apply_window_float;\n    s->apply_window_fixed = ff_mpadsp_apply_window_fixed;\n    s->dct32_float = dct.dct32;\n    s->dct32_fixed = ff_dct32_fixed;\n    if (ARCH_ARM)     ff_mpadsp_init_arm(s);\n    if (HAVE_MMX)     ff_mpadsp_init_mmx(s);\n    if (HAVE_ALTIVEC) ff_mpadsp_init_altivec(s);\n}', 'void ff_mpc_init(void)\n{\n    ff_mpa_synth_init_fixed(ff_mpa_synth_window_fixed);\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 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    unsigned int index = s->index;\n    uint8_t result = s->buffer[index>>3];\n#ifdef ALT_BITSTREAM_READER_LE\n    result >>= index & 7;\n    result &= 1;\n#else\n    result <<= index & 7;\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}']