libavcodec/wmavoice.c:1647: error: Null Dereference
  pointer `gb->buffer` last assigned on line 1640 could be null and is dereferenced by call to `get_bits1()` at line 1647, column 10.

libavcodec/wmavoice.c:1632:1: start of procedure check_bits_for_superframe()
1630.  * @return -1 if unsupported, 1 on not enough bits or 0 if OK.
1631.  */
1632. static int check_bits_for_superframe(GetBitContext *orig_gb,
      ^
1633.                                      WMAVoiceContext *s)
1634. {

libavcodec/wmavoice.c:1635:5: 
1633.                                      WMAVoiceContext *s)
1634. {
1635.     GetBitContext s_gb, *gb = &s_gb;
          ^
1636.     int n, need_bits, bd_idx;
1637.     const struct frame_type_desc *frame_desc;

libavcodec/wmavoice.c:1640:5: 
1638. 
1639.     /* initialize a copy */
1640.     init_get_bits(gb, orig_gb->buffer, orig_gb->size_in_bits);
          ^
1641.     skip_bits_long(gb, get_bits_count(orig_gb));
1642.     assert(get_bits_left(gb) == get_bits_left(orig_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/wmavoice.c:1641:5: 
1639.     /* initialize a copy */
1640.     init_get_bits(gb, orig_gb->buffer, orig_gb->size_in_bits);
1641.     skip_bits_long(gb, get_bits_count(orig_gb));
          ^
1642.     assert(get_bits_left(gb) == get_bits_left(orig_gb));
1643. 

libavcodec/get_bits.h:169:1: start of procedure get_bits_count()
  167. #   define GET_CACHE(name, gb) ((uint32_t)name##_cache)
  168. 
  169. static inline int get_bits_count(const GetBitContext *s){
       ^
  170.     return s->index;
  171. }

libavcodec/get_bits.h:170:5: 
  168. 
  169. static inline int get_bits_count(const GetBitContext *s){
  170.     return s->index;
           ^
  171. }
  172. 

libavcodec/get_bits.h:171:1: return from a call to get_bits_count
  169. static inline int get_bits_count(const GetBitContext *s){
  170.     return s->index;
  171. }
       ^
  172. 
  173. static inline void skip_bits_long(GetBitContext *s, int n){

libavcodec/get_bits.h:173:1: start of procedure skip_bits_long()
  171. }
  172. 
  173. static inline void skip_bits_long(GetBitContext *s, int n){
       ^
  174.     s->index += n;
  175. }

libavcodec/get_bits.h:174:5: 
  172. 
  173. static inline void skip_bits_long(GetBitContext *s, int n){
  174.     s->index += n;
           ^
  175. }
  176. 

libavcodec/get_bits.h:175:1: return from a call to skip_bits_long
  173. static inline void skip_bits_long(GetBitContext *s, int n){
  174.     s->index += n;
  175. }
       ^
  176. 
  177. #elif defined A32_BITSTREAM_READER

libavcodec/wmavoice.c:1642:5: 
1640.     init_get_bits(gb, orig_gb->buffer, orig_gb->size_in_bits);
1641.     skip_bits_long(gb, get_bits_count(orig_gb));
1642.     assert(get_bits_left(gb) == get_bits_left(orig_gb));
          ^
1643. 
1644.     /* superframe header */

libavcodec/wmavoice.c:1645:9: 
1643. 
1644.     /* superframe header */
1645.     if (get_bits_left(gb) < 14)
              ^
1646.         return 1;
1647.     if (!get_bits1(gb))

libavcodec/get_bits.h:536:1: start of procedure get_bits_left()
  534. }
  535. 
  536. static inline int get_bits_left(GetBitContext *gb)
       ^
  537. {
  538.     return gb->size_in_bits - get_bits_count(gb);

libavcodec/get_bits.h:538:5: 
  536. static inline int get_bits_left(GetBitContext *gb)
  537. {
  538.     return gb->size_in_bits - get_bits_count(gb);
           ^
  539. }
  540. 

libavcodec/get_bits.h:169:1: start of procedure get_bits_count()
    167. #   define GET_CACHE(name, gb) ((uint32_t)name##_cache)
    168. 
    169. static inline int get_bits_count(const GetBitContext *s){
         ^
    170.     return s->index;
    171. }

libavcodec/get_bits.h:170:5: 
    168. 
    169. static inline int get_bits_count(const GetBitContext *s){
    170.     return s->index;
             ^
    171. }
    172. 

libavcodec/get_bits.h:171:1: return from a call to get_bits_count
    169. static inline int get_bits_count(const GetBitContext *s){
    170.     return s->index;
    171. }
         ^
    172. 
    173. static inline void skip_bits_long(GetBitContext *s, int n){

libavcodec/get_bits.h:539:1: return from a call to get_bits_left
  537. {
  538.     return gb->size_in_bits - get_bits_count(gb);
  539. }
       ^
  540. 
  541. //#define TRACE

libavcodec/wmavoice.c:1645:9: Taking false branch
1643. 
1644.     /* superframe header */
1645.     if (get_bits_left(gb) < 14)
              ^
1646.         return 1;
1647.     if (!get_bits1(gb))

libavcodec/wmavoice.c:1647:10: 
1645.     if (get_bits_left(gb) < 14)
1646.         return 1;
1647.     if (!get_bits1(gb))
               ^
1648.         return -1;                        // WMAPro-in-WMAVoice superframe
1649.     if (get_bits1(gb)) skip_bits(gb, 12); // number of  samples in superframe

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 int check_bits_for_superframe(GetBitContext *orig_gb,
                                     WMAVoiceContext *s)
{
    GetBitContext s_gb, *gb = &s_gb;
    int n, need_bits, bd_idx;
    const struct frame_type_desc *frame_desc;
    init_get_bits(gb, orig_gb->buffer, orig_gb->size_in_bits);
    skip_bits_long(gb, get_bits_count(orig_gb));
    assert(get_bits_left(gb) == get_bits_left(orig_gb));
    if (get_bits_left(gb) < 14)
        return 1;
    if (!get_bits1(gb))
        return -1;
    if (get_bits1(gb)) skip_bits(gb, 12);
    if (s->has_residual_lsps) {
        if (get_bits_left(gb) < s->sframe_lsp_bitsize)
            return 1;
        skip_bits_long(gb, s->sframe_lsp_bitsize);
    }
    for (n = 0; n < MAX_FRAMES; n++) {
        int aw_idx_is_ext = 0;
        if (!s->has_residual_lsps) {
           if (get_bits_left(gb) < s->frame_lsp_bitsize) return 1;
           skip_bits_long(gb, s->frame_lsp_bitsize);
        }
        bd_idx = s->vbm_tree[get_vlc2(gb, frame_type_vlc.table, 6, 3)];
        if (bd_idx < 0)
            return -1;
        frame_desc = &frame_descs[bd_idx];
        if (frame_desc->acb_type == ACB_TYPE_ASYMMETRIC) {
            if (get_bits_left(gb) < s->pitch_nbits)
                return 1;
            skip_bits_long(gb, s->pitch_nbits);
        }
        if (frame_desc->fcb_type == FCB_TYPE_SILENCE) {
            skip_bits(gb, 8);
        } else if (frame_desc->fcb_type == FCB_TYPE_AW_PULSES) {
            int tmp = get_bits(gb, 6);
            if (tmp >= 0x36) {
                skip_bits(gb, 2);
                aw_idx_is_ext = 1;
            }
        }
        if (frame_desc->acb_type == ACB_TYPE_HAMMING) {
            need_bits = s->block_pitch_nbits +
                (frame_desc->n_blocks - 1) * s->block_delta_pitch_nbits;
        } else if (frame_desc->fcb_type == FCB_TYPE_AW_PULSES) {
            need_bits = 2 * !aw_idx_is_ext;
        } else
            need_bits = 0;
        need_bits += frame_desc->frame_size;
        if (get_bits_left(gb) < need_bits)
            return 1;
        skip_bits_long(gb, need_bits);
    }
    return 0;
}
['static int check_bits_for_superframe(GetBitContext *orig_gb,\n                                     WMAVoiceContext *s)\n{\n    GetBitContext s_gb, *gb = &s_gb;\n    int n, need_bits, bd_idx;\n    const struct frame_type_desc *frame_desc;\n    init_get_bits(gb, orig_gb->buffer, orig_gb->size_in_bits);\n    skip_bits_long(gb, get_bits_count(orig_gb));\n    assert(get_bits_left(gb) == get_bits_left(orig_gb));\n    if (get_bits_left(gb) < 14)\n        return 1;\n    if (!get_bits1(gb))\n        return -1;\n    if (get_bits1(gb)) skip_bits(gb, 12);\n    if (s->has_residual_lsps) {\n        if (get_bits_left(gb) < s->sframe_lsp_bitsize)\n            return 1;\n        skip_bits_long(gb, s->sframe_lsp_bitsize);\n    }\n    for (n = 0; n < MAX_FRAMES; n++) {\n        int aw_idx_is_ext = 0;\n        if (!s->has_residual_lsps) {\n           if (get_bits_left(gb) < s->frame_lsp_bitsize) return 1;\n           skip_bits_long(gb, s->frame_lsp_bitsize);\n        }\n        bd_idx = s->vbm_tree[get_vlc2(gb, frame_type_vlc.table, 6, 3)];\n        if (bd_idx < 0)\n            return -1;\n        frame_desc = &frame_descs[bd_idx];\n        if (frame_desc->acb_type == ACB_TYPE_ASYMMETRIC) {\n            if (get_bits_left(gb) < s->pitch_nbits)\n                return 1;\n            skip_bits_long(gb, s->pitch_nbits);\n        }\n        if (frame_desc->fcb_type == FCB_TYPE_SILENCE) {\n            skip_bits(gb, 8);\n        } else if (frame_desc->fcb_type == FCB_TYPE_AW_PULSES) {\n            int tmp = get_bits(gb, 6);\n            if (tmp >= 0x36) {\n                skip_bits(gb, 2);\n                aw_idx_is_ext = 1;\n            }\n        }\n        if (frame_desc->acb_type == ACB_TYPE_HAMMING) {\n            need_bits = s->block_pitch_nbits +\n                (frame_desc->n_blocks - 1) * s->block_delta_pitch_nbits;\n        } else if (frame_desc->fcb_type == FCB_TYPE_AW_PULSES) {\n            need_bits = 2 * !aw_idx_is_ext;\n        } else\n            need_bits = 0;\n        need_bits += frame_desc->frame_size;\n        if (get_bits_left(gb) < need_bits)\n            return 1;\n        skip_bits_long(gb, need_bits);\n    }\n    return 0;\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 int get_bits_count(const GetBitContext *s){\n    return s->index;\n}', 'static inline void skip_bits_long(GetBitContext *s, int n){\n    s->index += n;\n}', 'static inline int get_bits_left(GetBitContext *gb)\n{\n    return gb->size_in_bits - get_bits_count(gb);\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}']