libavcodec/aac_parser.c:43: error: Null Dereference
  pointer `&bits->buffer` last assigned on line 41 could be null and is dereferenced by call to `get_bits()` at line 43, column 8.

libavcodec/aac_parser.c:30:1: start of procedure aac_sync()
28. #define AAC_HEADER_SIZE 7
29. 
30. static int aac_sync(uint64_t state, AACAC3ParseContext *hdr_info,
    ^
31.         int *need_next_header, int *new_frame_start)
32. {

libavcodec/aac_parser.c:40:5: 
38.     } tmp;
39. 
40.     tmp.u64 = be2me_64(state);
        ^
41.     init_get_bits(&bits, tmp.u8+8-AAC_HEADER_SIZE, AAC_HEADER_SIZE * 8);
42. 

libavutil/bswap.h:61:1: start of procedure bswap_64()
  59. 
  60. #ifndef bswap_64
  61. static inline uint64_t av_const bswap_64(uint64_t x)
      ^
  62. {
  63. #if 0

libavutil/bswap.h:72:5: 
  70.         uint32_t l[2];
  71.     } w, r;
  72.     w.ll = x;
          ^
  73.     r.l[0] = bswap_32 (w.l[1]);
  74.     r.l[1] = bswap_32 (w.l[0]);

libavutil/bswap.h:73:5: 
  71.     } w, r;
  72.     w.ll = x;
  73.     r.l[0] = bswap_32 (w.l[1]);
          ^
  74.     r.l[1] = bswap_32 (w.l[0]);
  75.     return r.ll;

libavutil/bswap.h:52:1: start of procedure bswap_32()
    50. 
    51. #ifndef bswap_32
    52. static av_always_inline av_const uint32_t bswap_32(uint32_t x)
        ^
    53. {
    54.     x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);

libavutil/bswap.h:54:5: 
    52. static av_always_inline av_const uint32_t bswap_32(uint32_t x)
    53. {
    54.     x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);
            ^
    55.     x= (x>>16) | (x<<16);
    56.     return x;

libavutil/bswap.h:55:5: 
    53. {
    54.     x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);
    55.     x= (x>>16) | (x<<16);
            ^
    56.     return x;
    57. }

libavutil/bswap.h:56:5: 
    54.     x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);
    55.     x= (x>>16) | (x<<16);
    56.     return x;
            ^
    57. }
    58. #endif

libavutil/bswap.h:57:1: return from a call to bswap_32
    55.     x= (x>>16) | (x<<16);
    56.     return x;
    57. }
        ^
    58. #endif
    59. 

libavutil/bswap.h:74:5: 
  72.     w.ll = x;
  73.     r.l[0] = bswap_32 (w.l[1]);
  74.     r.l[1] = bswap_32 (w.l[0]);
          ^
  75.     return r.ll;
  76. #endif

libavutil/bswap.h:52:1: start of procedure bswap_32()
    50. 
    51. #ifndef bswap_32
    52. static av_always_inline av_const uint32_t bswap_32(uint32_t x)
        ^
    53. {
    54.     x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);

libavutil/bswap.h:54:5: 
    52. static av_always_inline av_const uint32_t bswap_32(uint32_t x)
    53. {
    54.     x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);
            ^
    55.     x= (x>>16) | (x<<16);
    56.     return x;

libavutil/bswap.h:55:5: 
    53. {
    54.     x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);
    55.     x= (x>>16) | (x<<16);
            ^
    56.     return x;
    57. }

libavutil/bswap.h:56:5: 
    54.     x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);
    55.     x= (x>>16) | (x<<16);
    56.     return x;
            ^
    57. }
    58. #endif

libavutil/bswap.h:57:1: return from a call to bswap_32
    55.     x= (x>>16) | (x<<16);
    56.     return x;
    57. }
        ^
    58. #endif
    59. 

libavutil/bswap.h:75:5: 
  73.     r.l[0] = bswap_32 (w.l[1]);
  74.     r.l[1] = bswap_32 (w.l[0]);
  75.     return r.ll;
          ^
  76. #endif
  77. }

libavutil/bswap.h:77:1: return from a call to bswap_64
  75.     return r.ll;
  76. #endif
  77. }
      ^
  78. #endif
  79. 

libavcodec/aac_parser.c:41:5: 
39. 
40.     tmp.u64 = be2me_64(state);
41.     init_get_bits(&bits, tmp.u8+8-AAC_HEADER_SIZE, AAC_HEADER_SIZE * 8);
        ^
42. 
43.     if(get_bits(&bits, 12) != 0xfff)

libavcodec/bitstream.h:745:1: start of procedure init_get_bits()
  743.  * @param bit_size the size of the buffer in bits
  744.  */
  745. static inline void init_get_bits(GetBitContext *s,
       ^
  746.                    const uint8_t *buffer, int bit_size)
  747. {

libavcodec/bitstream.h:748:5: 
  746.                    const uint8_t *buffer, int bit_size)
  747. {
  748.     int buffer_size= (bit_size+7)>>3;
           ^
  749.     if(buffer_size < 0 || bit_size < 0) {
  750.         buffer_size = bit_size = 0;

libavcodec/bitstream.h:749:8: Taking true branch
  747. {
  748.     int buffer_size= (bit_size+7)>>3;
  749.     if(buffer_size < 0 || bit_size < 0) {
              ^
  750.         buffer_size = bit_size = 0;
  751.         buffer = NULL;

libavcodec/bitstream.h:750:9: 
  748.     int buffer_size= (bit_size+7)>>3;
  749.     if(buffer_size < 0 || bit_size < 0) {
  750.         buffer_size = bit_size = 0;
               ^
  751.         buffer = NULL;
  752.     }

libavcodec/bitstream.h:751:9: 
  749.     if(buffer_size < 0 || bit_size < 0) {
  750.         buffer_size = bit_size = 0;
  751.         buffer = NULL;
               ^
  752.     }
  753. 

libavcodec/bitstream.h:754:5: 
  752.     }
  753. 
  754.     s->buffer= buffer;
           ^
  755.     s->size_in_bits= bit_size;
  756.     s->buffer_end= buffer + buffer_size;

libavcodec/bitstream.h:755:5: 
  753. 
  754.     s->buffer= buffer;
  755.     s->size_in_bits= bit_size;
           ^
  756.     s->buffer_end= buffer + buffer_size;
  757. #ifdef ALT_BITSTREAM_READER

libavcodec/bitstream.h:756:5: 
  754.     s->buffer= buffer;
  755.     s->size_in_bits= bit_size;
  756.     s->buffer_end= buffer + buffer_size;
           ^
  757. #ifdef ALT_BITSTREAM_READER
  758.     s->index=0;

libavcodec/bitstream.h:758:5: 
  756.     s->buffer_end= buffer + buffer_size;
  757. #ifdef ALT_BITSTREAM_READER
  758.     s->index=0;
           ^
  759. #elif defined LIBMPEG2_BITSTREAM_READER
  760.     s->buffer_ptr = (uint8_t*)((intptr_t)buffer&(~1));

libavcodec/bitstream.h:768:1: return from a call to init_get_bits
  766.     skip_bits_long(s, 0);
  767. #endif
  768. }
       ^
  769. 
  770. static inline void align_get_bits(GetBitContext *s)

libavcodec/aac_parser.c:43:8: 
41.     init_get_bits(&bits, tmp.u8+8-AAC_HEADER_SIZE, AAC_HEADER_SIZE * 8);
42. 
43.     if(get_bits(&bits, 12) != 0xfff)
           ^
44.         return 0;
45. 

libavcodec/bitstream.h:642:1: start of procedure get_bits()
  640.  * Note, the alt bitstream reader can read up to 25 bits, but the libmpeg2 reader can't
  641.  */
  642. static inline unsigned int get_bits(GetBitContext *s, int n){
       ^
  643.     register int tmp;
  644.     OPEN_READER(re, s)

libavcodec/bitstream.h:644:5: 
  642. static inline unsigned int get_bits(GetBitContext *s, int n){
  643.     register int tmp;
  644.     OPEN_READER(re, s)
           ^
  645.     UPDATE_CACHE(re, s)
  646.     tmp= SHOW_UBITS(re, s, n);

libavcodec/bitstream.h:645:5: 
  643.     register int tmp;
  644.     OPEN_READER(re, s)
  645.     UPDATE_CACHE(re, s)
           ^
  646.     tmp= SHOW_UBITS(re, s, n);
  647.     LAST_SKIP_BITS(re, s, n)

static int aac_sync(uint64_t state, AACAC3ParseContext *hdr_info,
        int *need_next_header, int *new_frame_start)
{
    GetBitContext bits;
    int size, rdb, ch, sr;
    union {
        uint64_t u64;
        uint8_t  u8[8];
    } tmp;
    tmp.u64 = be2me_64(state);
    init_get_bits(&bits, tmp.u8+8-AAC_HEADER_SIZE, AAC_HEADER_SIZE * 8);
    if(get_bits(&bits, 12) != 0xfff)
        return 0;
    skip_bits1(&bits);
    skip_bits(&bits, 2);
    skip_bits1(&bits);
    skip_bits(&bits, 2);
    sr = get_bits(&bits, 4);
    if(!ff_mpeg4audio_sample_rates[sr])
        return 0;
    skip_bits1(&bits);
    ch = get_bits(&bits, 3);
    if(!ff_mpeg4audio_channels[ch])
        return 0;
    skip_bits1(&bits);
    skip_bits1(&bits);
    skip_bits1(&bits);
    skip_bits1(&bits);
    size = get_bits(&bits, 13);
    if(size < AAC_HEADER_SIZE)
        return 0;
    skip_bits(&bits, 11);
    rdb = get_bits(&bits, 2);
    hdr_info->channels = ff_mpeg4audio_channels[ch];
    hdr_info->sample_rate = ff_mpeg4audio_sample_rates[sr];
    hdr_info->samples = (rdb + 1) * 1024;
    hdr_info->bit_rate = size * 8 * hdr_info->sample_rate / hdr_info->samples;
    *need_next_header = 0;
    *new_frame_start  = 1;
    return size;
}
['static int aac_sync(uint64_t state, AACAC3ParseContext *hdr_info,\n        int *need_next_header, int *new_frame_start)\n{\n    GetBitContext bits;\n    int size, rdb, ch, sr;\n    union {\n        uint64_t u64;\n        uint8_t  u8[8];\n    } tmp;\n    tmp.u64 = be2me_64(state);\n    init_get_bits(&bits, tmp.u8+8-AAC_HEADER_SIZE, AAC_HEADER_SIZE * 8);\n    if(get_bits(&bits, 12) != 0xfff)\n        return 0;\n    skip_bits1(&bits);\n    skip_bits(&bits, 2);\n    skip_bits1(&bits);\n    skip_bits(&bits, 2);\n    sr = get_bits(&bits, 4);\n    if(!ff_mpeg4audio_sample_rates[sr])\n        return 0;\n    skip_bits1(&bits);\n    ch = get_bits(&bits, 3);\n    if(!ff_mpeg4audio_channels[ch])\n        return 0;\n    skip_bits1(&bits);\n    skip_bits1(&bits);\n    skip_bits1(&bits);\n    skip_bits1(&bits);\n    size = get_bits(&bits, 13);\n    if(size < AAC_HEADER_SIZE)\n        return 0;\n    skip_bits(&bits, 11);\n    rdb = get_bits(&bits, 2);\n    hdr_info->channels = ff_mpeg4audio_channels[ch];\n    hdr_info->sample_rate = ff_mpeg4audio_sample_rates[sr];\n    hdr_info->samples = (rdb + 1) * 1024;\n    hdr_info->bit_rate = size * 8 * hdr_info->sample_rate / hdr_info->samples;\n    *need_next_header = 0;\n    *new_frame_start  = 1;\n    return size;\n}', 'static inline uint64_t av_const bswap_64(uint64_t x)\n{\n#if 0\n    x= ((x<< 8)&0xFF00FF00FF00FF00ULL) | ((x>> 8)&0x00FF00FF00FF00FFULL);\n    x= ((x<<16)&0xFFFF0000FFFF0000ULL) | ((x>>16)&0x0000FFFF0000FFFFULL);\n    return (x>>32) | (x<<32);\n#else\n    union {\n        uint64_t ll;\n        uint32_t l[2];\n    } w, r;\n    w.ll = x;\n    r.l[0] = bswap_32 (w.l[1]);\n    r.l[1] = bswap_32 (w.l[0]);\n    return r.ll;\n#endif\n}', 'static av_always_inline av_const uint32_t bswap_32(uint32_t x)\n{\n    x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);\n    x= (x>>16) | (x<<16);\n    return x;\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_bits(GetBitContext *s, int n){\n    register int tmp;\n    OPEN_READER(re, s)\n    UPDATE_CACHE(re, s)\n    tmp= SHOW_UBITS(re, s, n);\n    LAST_SKIP_BITS(re, s, n)\n    CLOSE_READER(re, s)\n    return tmp;\n}']