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

libavcodec/wmavoice.c:1667:1: start of procedure check_bits_for_superframe()
1665.  * @return < 0 on error, 1 on not enough bits or 0 if OK.
1666.  */
1667. static int check_bits_for_superframe(GetBitContext *orig_gb,
      ^
1668.                                      WMAVoiceContext *s)
1669. {

libavcodec/wmavoice.c:1670:5: 
1668.                                      WMAVoiceContext *s)
1669. {
1670.     GetBitContext s_gb, *gb = &s_gb;
          ^
1671.     int n, need_bits, bd_idx;
1672.     const struct frame_type_desc *frame_desc;

libavcodec/wmavoice.c:1675:5: 
1673. 
1674.     /* initialize a copy */
1675.     init_get_bits(gb, orig_gb->buffer, orig_gb->size_in_bits);
          ^
1676.     skip_bits_long(gb, get_bits_count(orig_gb));
1677.     assert(get_bits_left(gb) == get_bits_left(orig_gb));

libavcodec/get_bits.h:362:1: start of procedure init_get_bits()
  360.  * @return 0 on success, AVERROR_INVALIDDATA if the buffer_size would overflow.
  361.  */
  362. static inline int init_get_bits(GetBitContext *s, const uint8_t *buffer,
       ^
  363.                                 int bit_size)
  364. {

libavcodec/get_bits.h:366:5: 
  364. {
  365.     int buffer_size;
  366.     int ret = 0;
           ^
  367. 
  368.     if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) {

libavcodec/get_bits.h:368:9: Taking true branch
  366.     int ret = 0;
  367. 
  368.     if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) {
               ^
  369.         bit_size    = 0;
  370.         buffer      = NULL;

libavcodec/get_bits.h:369:9: 
  367. 
  368.     if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) {
  369.         bit_size    = 0;
               ^
  370.         buffer      = NULL;
  371.         ret         = AVERROR_INVALIDDATA;

libavcodec/get_bits.h:370:9: 
  368.     if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) {
  369.         bit_size    = 0;
  370.         buffer      = NULL;
               ^
  371.         ret         = AVERROR_INVALIDDATA;
  372.     }

libavcodec/get_bits.h:371:9: 
  369.         bit_size    = 0;
  370.         buffer      = NULL;
  371.         ret         = AVERROR_INVALIDDATA;
               ^
  372.     }
  373. 

libavcodec/get_bits.h:374:5: 
  372.     }
  373. 
  374.     buffer_size = (bit_size + 7) >> 3;
           ^
  375. 
  376.     s->buffer             = buffer;

libavcodec/get_bits.h:376:5: 
  374.     buffer_size = (bit_size + 7) >> 3;
  375. 
  376.     s->buffer             = buffer;
           ^
  377.     s->size_in_bits       = bit_size;
  378. #if !UNCHECKED_BITSTREAM_READER

libavcodec/get_bits.h:377:5: 
  375. 
  376.     s->buffer             = buffer;
  377.     s->size_in_bits       = bit_size;
           ^
  378. #if !UNCHECKED_BITSTREAM_READER
  379.     s->size_in_bits_plus8 = bit_size + 8;

libavcodec/get_bits.h:379:5: 
  377.     s->size_in_bits       = bit_size;
  378. #if !UNCHECKED_BITSTREAM_READER
  379.     s->size_in_bits_plus8 = bit_size + 8;
           ^
  380. #endif
  381.     s->buffer_end         = buffer + buffer_size;

libavcodec/get_bits.h:381:5: 
  379.     s->size_in_bits_plus8 = bit_size + 8;
  380. #endif
  381.     s->buffer_end         = buffer + buffer_size;
           ^
  382.     s->index              = 0;
  383. 

libavcodec/get_bits.h:382:5: 
  380. #endif
  381.     s->buffer_end         = buffer + buffer_size;
  382.     s->index              = 0;
           ^
  383. 
  384.     return ret;

libavcodec/get_bits.h:384:5: 
  382.     s->index              = 0;
  383. 
  384.     return ret;
           ^
  385. }
  386. 

libavcodec/get_bits.h:385:1: return from a call to init_get_bits
  383. 
  384.     return ret;
  385. }
       ^
  386. 
  387. /**

libavcodec/wmavoice.c:1676:5: 
1674.     /* initialize a copy */
1675.     init_get_bits(gb, orig_gb->buffer, orig_gb->size_in_bits);
1676.     skip_bits_long(gb, get_bits_count(orig_gb));
          ^
1677.     assert(get_bits_left(gb) == get_bits_left(orig_gb));
1678. 

libavcodec/get_bits.h:182:1: start of procedure get_bits_count()
  180. #define GET_CACHE(name, gb) ((uint32_t) name ## _cache)
  181. 
  182. static inline int get_bits_count(const GetBitContext *s)
       ^
  183. {
  184.     return s->index;

libavcodec/get_bits.h:184:5: 
  182. static inline int get_bits_count(const GetBitContext *s)
  183. {
  184.     return s->index;
           ^
  185. }
  186. 

libavcodec/get_bits.h:185:1: return from a call to get_bits_count
  183. {
  184.     return s->index;
  185. }
       ^
  186. 
  187. static inline void skip_bits_long(GetBitContext *s, int n)

libavcodec/get_bits.h:187:1: start of procedure skip_bits_long()
  185. }
  186. 
  187. static inline void skip_bits_long(GetBitContext *s, int n)
       ^
  188. {
  189. #if UNCHECKED_BITSTREAM_READER

libavcodec/get_bits.h:190:5: 
  188. {
  189. #if UNCHECKED_BITSTREAM_READER
  190.     s->index += n;
           ^
  191. #else
  192.     s->index += av_clip(n, -s->index, s->size_in_bits_plus8 - s->index);

libavcodec/get_bits.h:194:1: return from a call to skip_bits_long
  192.     s->index += av_clip(n, -s->index, s->size_in_bits_plus8 - s->index);
  193. #endif
  194. }
       ^
  195. 
  196. /**

libavcodec/wmavoice.c:1677:5: 
1675.     init_get_bits(gb, orig_gb->buffer, orig_gb->size_in_bits);
1676.     skip_bits_long(gb, get_bits_count(orig_gb));
1677.     assert(get_bits_left(gb) == get_bits_left(orig_gb));
          ^
1678. 
1679.     /* superframe header */

libavcodec/wmavoice.c:1680:9: 
1678. 
1679.     /* superframe header */
1680.     if (get_bits_left(gb) < 14)
              ^
1681.         return 1;
1682.     if (!get_bits1(gb))

libavcodec/get_bits.h:526:1: start of procedure get_bits_left()
  524. }
  525. 
  526. static inline int get_bits_left(GetBitContext *gb)
       ^
  527. {
  528.     return gb->size_in_bits - get_bits_count(gb);

libavcodec/get_bits.h:528:5: 
  526. static inline int get_bits_left(GetBitContext *gb)
  527. {
  528.     return gb->size_in_bits - get_bits_count(gb);
           ^
  529. }
  530. 

libavcodec/get_bits.h:182:1: start of procedure get_bits_count()
    180. #define GET_CACHE(name, gb) ((uint32_t) name ## _cache)
    181. 
    182. static inline int get_bits_count(const GetBitContext *s)
         ^
    183. {
    184.     return s->index;

libavcodec/get_bits.h:184:5: 
    182. static inline int get_bits_count(const GetBitContext *s)
    183. {
    184.     return s->index;
             ^
    185. }
    186. 

libavcodec/get_bits.h:185:1: return from a call to get_bits_count
    183. {
    184.     return s->index;
    185. }
         ^
    186. 
    187. static inline void skip_bits_long(GetBitContext *s, int n)

libavcodec/get_bits.h:529:1: return from a call to get_bits_left
  527. {
  528.     return gb->size_in_bits - get_bits_count(gb);
  529. }
       ^
  530. 
  531. #endif /* AVCODEC_GET_BITS_H */

libavcodec/wmavoice.c:1680:9: Taking false branch
1678. 
1679.     /* superframe header */
1680.     if (get_bits_left(gb) < 14)
              ^
1681.         return 1;
1682.     if (!get_bits1(gb))

libavcodec/wmavoice.c:1682:10: 
1680.     if (get_bits_left(gb) < 14)
1681.         return 1;
1682.     if (!get_bits1(gb))
               ^
1683.         return AVERROR(ENOSYS);           // WMAPro-in-WMAVoice superframe
1684.     if (get_bits1(gb)) skip_bits(gb, 12); // number of  samples in superframe

libavcodec/get_bits.h:267:1: start of procedure get_bits1()
  265. }
  266. 
  267. static inline unsigned int get_bits1(GetBitContext *s)
       ^
  268. {
  269.     unsigned int index = s->index;

libavcodec/get_bits.h:269:5: 
  267. static inline unsigned int get_bits1(GetBitContext *s)
  268. {
  269.     unsigned int index = s->index;
           ^
  270.     uint8_t result     = s->buffer[index >> 3];
  271. #ifdef BITSTREAM_READER_LE

libavcodec/get_bits.h:270:5: 
  268. {
  269.     unsigned int index = s->index;
  270.     uint8_t result     = s->buffer[index >> 3];
           ^
  271. #ifdef BITSTREAM_READER_LE
  272.     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 AVERROR(ENOSYS);
    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 AVERROR_INVALIDDATA;
        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 AVERROR(ENOSYS);\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 AVERROR_INVALIDDATA;\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 int init_get_bits(GetBitContext *s, const uint8_t *buffer,\n                                int bit_size)\n{\n    int buffer_size;\n    int ret = 0;\n    if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) {\n        bit_size    = 0;\n        buffer      = NULL;\n        ret         = AVERROR_INVALIDDATA;\n    }\n    buffer_size = (bit_size + 7) >> 3;\n    s->buffer             = buffer;\n    s->size_in_bits       = bit_size;\n#if !UNCHECKED_BITSTREAM_READER\n    s->size_in_bits_plus8 = bit_size + 8;\n#endif\n    s->buffer_end         = buffer + buffer_size;\n    s->index              = 0;\n    return ret;\n}', 'static inline int get_bits_count(const GetBitContext *s)\n{\n    return s->index;\n}', 'static inline void skip_bits_long(GetBitContext *s, int n)\n{\n#if UNCHECKED_BITSTREAM_READER\n    s->index += n;\n#else\n    s->index += av_clip(n, -s->index, s->size_in_bits_plus8 - s->index);\n#endif\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{\n    unsigned int index = s->index;\n    uint8_t result     = s->buffer[index >> 3];\n#ifdef BITSTREAM_READER_LE\n    result >>= index & 7;\n    result  &= 1;\n#else\n    result <<= index & 7;\n    result >>= 8 - 1;\n#endif\n#if !UNCHECKED_BITSTREAM_READER\n    if (s->index < s->size_in_bits_plus8)\n#endif\n        index++;\n    s->index = index;\n    return result;\n}']