libavformat/mpc8.c:104: error: Null Dereference
  pointer `&gb->buffer` last assigned on line 103 could be null and is dereferenced by call to `gb_get_v()` at line 104, column 12.

libavformat/mpc8.c:85:1: start of procedure mpc8_parse_seektable()
83. }
84. 
85. static void mpc8_parse_seektable(AVFormatContext *s, int64_t off)
    ^
86. {
87.     MPCContext *c = s->priv_data;

libavformat/mpc8.c:87:5: 
85. static void mpc8_parse_seektable(AVFormatContext *s, int64_t off)
86. {
87.     MPCContext *c = s->priv_data;
        ^
88.     int tag;
89.     int64_t size, pos, ppos[2];

libavformat/mpc8.c:94:5: Skipping url_fseek(): empty list of specs
92.     GetBitContext gb;
93. 
94.     url_fseek(s->pb, off, SEEK_SET);
        ^
95.     mpc8_get_chunk_header(s->pb, &tag, &size);
96.     if(tag != TAG_SEEKTABLE){

libavformat/mpc8.c:95:5: Skipping mpc8_get_chunk_header(): empty list of specs
93. 
94.     url_fseek(s->pb, off, SEEK_SET);
95.     mpc8_get_chunk_header(s->pb, &tag, &size);
        ^
96.     if(tag != TAG_SEEKTABLE){
97.         av_log(s, AV_LOG_ERROR, "No seek table at given position\n");

libavformat/mpc8.c:96:8: Taking false branch
94.     url_fseek(s->pb, off, SEEK_SET);
95.     mpc8_get_chunk_header(s->pb, &tag, &size);
96.     if(tag != TAG_SEEKTABLE){
           ^
97.         av_log(s, AV_LOG_ERROR, "No seek table at given position\n");
98.         return;

libavformat/mpc8.c:100:10: 
 98.         return;
 99.     }
100.     if(!(buf = av_malloc(size)))
              ^
101.         return;
102.     get_buffer(s->pb, buf, size);

libavutil/mem.c:47:1: start of procedure av_malloc()
  45.    linker will do it automatically. */
  46. 
  47. void *av_malloc(unsigned int size)
      ^
  48. {
  49.     void *ptr = NULL;

libavutil/mem.c:49:5: 
  47. void *av_malloc(unsigned int size)
  48. {
  49.     void *ptr = NULL;
          ^
  50. #if CONFIG_MEMALIGN_HACK
  51.     long diff;

libavutil/mem.c:55:8: Taking false branch
  53. 
  54.     /* let's disallow possible ambiguous cases */
  55.     if(size > (INT_MAX-16) )
             ^
  56.         return NULL;
  57. 

libavutil/mem.c:66:5: Skipping posix_memalign(): method has no implementation
  64.     ((char*)ptr)[-1]= diff;
  65. #elif HAVE_POSIX_MEMALIGN
  66.     posix_memalign(&ptr,16,size);
          ^
  67. #elif HAVE_MEMALIGN
  68.     ptr = memalign(16,size);

libavutil/mem.c:98:5: 
   96.     ptr = malloc(size);
   97. #endif
   98.     return ptr;
           ^
   99. }
  100. 

libavutil/mem.c:99:1: return from a call to av_malloc
   97. #endif
   98.     return ptr;
   99. }
       ^
  100. 
  101. void *av_realloc(void *ptr, unsigned int size)

libavformat/mpc8.c:100:10: Taking false branch
 98.         return;
 99.     }
100.     if(!(buf = av_malloc(size)))
              ^
101.         return;
102.     get_buffer(s->pb, buf, size);

libavformat/mpc8.c:102:5: Skipping get_buffer(): empty list of specs
100.     if(!(buf = av_malloc(size)))
101.         return;
102.     get_buffer(s->pb, buf, size);
         ^
103.     init_get_bits(&gb, buf, size * 8);
104.     size = gb_get_v(&gb);

libavformat/mpc8.c:103:5: 
101.         return;
102.     get_buffer(s->pb, buf, size);
103.     init_get_bits(&gb, buf, size * 8);
         ^
104.     size = gb_get_v(&gb);
105.     if(size > UINT_MAX/4 || size > c->samples/1152){

libavcodec/bitstream.h:737:1: start of procedure init_get_bits()
  735.  * @param bit_size the size of the buffer in bits
  736.  */
  737. static inline void init_get_bits(GetBitContext *s,
       ^
  738.                    const uint8_t *buffer, int bit_size)
  739. {

libavcodec/bitstream.h:740:5: 
  738.                    const uint8_t *buffer, int bit_size)
  739. {
  740.     int buffer_size= (bit_size+7)>>3;
           ^
  741.     if(buffer_size < 0 || bit_size < 0) {
  742.         buffer_size = bit_size = 0;

libavcodec/bitstream.h:741:8: Taking true branch
  739. {
  740.     int buffer_size= (bit_size+7)>>3;
  741.     if(buffer_size < 0 || bit_size < 0) {
              ^
  742.         buffer_size = bit_size = 0;
  743.         buffer = NULL;

libavcodec/bitstream.h:742:9: 
  740.     int buffer_size= (bit_size+7)>>3;
  741.     if(buffer_size < 0 || bit_size < 0) {
  742.         buffer_size = bit_size = 0;
               ^
  743.         buffer = NULL;
  744.     }

libavcodec/bitstream.h:743:9: 
  741.     if(buffer_size < 0 || bit_size < 0) {
  742.         buffer_size = bit_size = 0;
  743.         buffer = NULL;
               ^
  744.     }
  745. 

libavcodec/bitstream.h:746:5: 
  744.     }
  745. 
  746.     s->buffer= buffer;
           ^
  747.     s->size_in_bits= bit_size;
  748.     s->buffer_end= buffer + buffer_size;

libavcodec/bitstream.h:747:5: 
  745. 
  746.     s->buffer= buffer;
  747.     s->size_in_bits= bit_size;
           ^
  748.     s->buffer_end= buffer + buffer_size;
  749. #ifdef ALT_BITSTREAM_READER

libavcodec/bitstream.h:748:5: 
  746.     s->buffer= buffer;
  747.     s->size_in_bits= bit_size;
  748.     s->buffer_end= buffer + buffer_size;
           ^
  749. #ifdef ALT_BITSTREAM_READER
  750.     s->index=0;

libavcodec/bitstream.h:750:5: 
  748.     s->buffer_end= buffer + buffer_size;
  749. #ifdef ALT_BITSTREAM_READER
  750.     s->index=0;
           ^
  751. #elif defined LIBMPEG2_BITSTREAM_READER
  752.     s->buffer_ptr = (uint8_t*)((intptr_t)buffer&(~1));

libavcodec/bitstream.h:760:1: return from a call to init_get_bits
  758.     skip_bits_long(s, 0);
  759. #endif
  760. }
       ^
  761. 
  762. static inline void align_get_bits(GetBitContext *s)

libavformat/mpc8.c:104:5: 
102.     get_buffer(s->pb, buf, size);
103.     init_get_bits(&gb, buf, size * 8);
104.     size = gb_get_v(&gb);
         ^
105.     if(size > UINT_MAX/4 || size > c->samples/1152){
106.         av_log(s, AV_LOG_ERROR, "Seek table is too big\n");

libavformat/mpc8.c:61:1: start of procedure gb_get_v()
  59. }
  60. 
  61. static inline int64_t gb_get_v(GetBitContext *gb)
      ^
  62. {
  63.     int64_t v = 0;

libavformat/mpc8.c:63:5: 
  61. static inline int64_t gb_get_v(GetBitContext *gb)
  62. {
  63.     int64_t v = 0;
          ^
  64.     int bits = 0;
  65.     while(get_bits1(gb) && bits < 64-7){

libavformat/mpc8.c:64:5: 
  62. {
  63.     int64_t v = 0;
  64.     int bits = 0;
          ^
  65.     while(get_bits1(gb) && bits < 64-7){
  66.         v <<= 7;

libavformat/mpc8.c:65:11: 
  63.     int64_t v = 0;
  64.     int bits = 0;
  65.     while(get_bits1(gb) && bits < 64-7){
                ^
  66.         v <<= 7;
  67.         v |= get_bits(gb, 7);

libavcodec/bitstream.h:665:1: start of procedure get_bits1()
    663. }
    664. 
    665. static inline unsigned int get_bits1(GetBitContext *s){
         ^
    666. #ifdef ALT_BITSTREAM_READER
    667.     int index= s->index;

libavcodec/bitstream.h:667:5: 
    665. static inline unsigned int get_bits1(GetBitContext *s){
    666. #ifdef ALT_BITSTREAM_READER
    667.     int index= s->index;
             ^
    668.     uint8_t result= s->buffer[ index>>3 ];
    669. #ifdef ALT_BITSTREAM_READER_LE

libavcodec/bitstream.h:668:5: 
    666. #ifdef ALT_BITSTREAM_READER
    667.     int index= s->index;
    668.     uint8_t result= s->buffer[ index>>3 ];
             ^
    669. #ifdef ALT_BITSTREAM_READER_LE
    670.     result>>= (index&0x07);

libavcodec/bitstream.h:673:5: 
    671.     result&= 1;
    672. #else
    673.     result<<= (index&0x07);
             ^
    674.     result>>= 8 - 1;
    675. #endif

libavcodec/bitstream.h:674:5: 
    672. #else
    673.     result<<= (index&0x07);
    674.     result>>= 8 - 1;
             ^
    675. #endif
    676.     index++;

libavcodec/bitstream.h:676:5: 
    674.     result>>= 8 - 1;
    675. #endif
    676.     index++;
             ^
    677.     s->index= index;
    678. 

libavcodec/bitstream.h:677:5: 
    675. #endif
    676.     index++;
    677.     s->index= index;
             ^
    678. 
    679.     return result;

libavcodec/bitstream.h:679:5: 
    677.     s->index= index;
    678. 
    679.     return result;
             ^
    680. #else
    681.     return get_bits(s, 1);

libavcodec/bitstream.h:683:1: return from a call to get_bits1
    681.     return get_bits(s, 1);
    682. #endif
    683. }
         ^
    684. 
    685. static inline unsigned int show_bits1(GetBitContext *s){

libavformat/mpc8.c:65:11: Loop condition is true. Entering loop body
  63.     int64_t v = 0;
  64.     int bits = 0;
  65.     while(get_bits1(gb) && bits < 64-7){
                ^
  66.         v <<= 7;
  67.         v |= get_bits(gb, 7);

libavformat/mpc8.c:65:28: Loop condition is true. Entering loop body
  63.     int64_t v = 0;
  64.     int bits = 0;
  65.     while(get_bits1(gb) && bits < 64-7){
                                 ^
  66.         v <<= 7;
  67.         v |= get_bits(gb, 7);

libavformat/mpc8.c:66:9: 
  64.     int bits = 0;
  65.     while(get_bits1(gb) && bits < 64-7){
  66.         v <<= 7;
              ^
  67.         v |= get_bits(gb, 7);
  68.         bits += 7;

libavformat/mpc8.c:67:9: 
  65.     while(get_bits1(gb) && bits < 64-7){
  66.         v <<= 7;
  67.         v |= get_bits(gb, 7);
              ^
  68.         bits += 7;
  69.     }

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

libavcodec/bitstream.h:636:5: 
    634. static inline unsigned int get_bits(GetBitContext *s, int n){
    635.     register int tmp;
    636.     OPEN_READER(re, s)
             ^
    637.     UPDATE_CACHE(re, s)
    638.     tmp= SHOW_UBITS(re, s, n);

libavcodec/bitstream.h:637:5: 
    635.     register int tmp;
    636.     OPEN_READER(re, s)
    637.     UPDATE_CACHE(re, s)
             ^
    638.     tmp= SHOW_UBITS(re, s, n);
    639.     LAST_SKIP_BITS(re, s, n)

libavcodec/bitstream.h:638:5: 
    636.     OPEN_READER(re, s)
    637.     UPDATE_CACHE(re, s)
    638.     tmp= SHOW_UBITS(re, s, n);
             ^
    639.     LAST_SKIP_BITS(re, s, n)
    640.     CLOSE_READER(re, s)

libavcodec/bitstream.h:639:5: 
    637.     UPDATE_CACHE(re, s)
    638.     tmp= SHOW_UBITS(re, s, n);
    639.     LAST_SKIP_BITS(re, s, n)
             ^
    640.     CLOSE_READER(re, s)
    641.     return tmp;

libavcodec/bitstream.h:640:5: 
    638.     tmp= SHOW_UBITS(re, s, n);
    639.     LAST_SKIP_BITS(re, s, n)
    640.     CLOSE_READER(re, s)
             ^
    641.     return tmp;
    642. }

libavcodec/bitstream.h:641:5: 
    639.     LAST_SKIP_BITS(re, s, n)
    640.     CLOSE_READER(re, s)
    641.     return tmp;
             ^
    642. }
    643. 

libavcodec/bitstream.h:642:1: return from a call to get_bits
    640.     CLOSE_READER(re, s)
    641.     return tmp;
    642. }
         ^
    643. 
    644. /**

libavformat/mpc8.c:68:9: 
  66.         v <<= 7;
  67.         v |= get_bits(gb, 7);
  68.         bits += 7;
              ^
  69.     }
  70.     v <<= 7;

libavformat/mpc8.c:65:11: 
  63.     int64_t v = 0;
  64.     int bits = 0;
  65.     while(get_bits1(gb) && bits < 64-7){
                ^
  66.         v <<= 7;
  67.         v |= get_bits(gb, 7);

libavcodec/bitstream.h:665:1: start of procedure get_bits1()
    663. }
    664. 
    665. static inline unsigned int get_bits1(GetBitContext *s){
         ^
    666. #ifdef ALT_BITSTREAM_READER
    667.     int index= s->index;

libavcodec/bitstream.h:667:5: 
    665. static inline unsigned int get_bits1(GetBitContext *s){
    666. #ifdef ALT_BITSTREAM_READER
    667.     int index= s->index;
             ^
    668.     uint8_t result= s->buffer[ index>>3 ];
    669. #ifdef ALT_BITSTREAM_READER_LE

libavcodec/bitstream.h:668:5: 
    666. #ifdef ALT_BITSTREAM_READER
    667.     int index= s->index;
    668.     uint8_t result= s->buffer[ index>>3 ];
             ^
    669. #ifdef ALT_BITSTREAM_READER_LE
    670.     result>>= (index&0x07);

libavcodec/bitstream.h:673:5: 
    671.     result&= 1;
    672. #else
    673.     result<<= (index&0x07);
             ^
    674.     result>>= 8 - 1;
    675. #endif

libavcodec/bitstream.h:674:5: 
    672. #else
    673.     result<<= (index&0x07);
    674.     result>>= 8 - 1;
             ^
    675. #endif
    676.     index++;

libavcodec/bitstream.h:676:5: 
    674.     result>>= 8 - 1;
    675. #endif
    676.     index++;
             ^
    677.     s->index= index;
    678. 

libavcodec/bitstream.h:677:5: 
    675. #endif
    676.     index++;
    677.     s->index= index;
             ^
    678. 
    679.     return result;

libavcodec/bitstream.h:679:5: 
    677.     s->index= index;
    678. 
    679.     return result;
             ^
    680. #else
    681.     return get_bits(s, 1);

libavcodec/bitstream.h:683:1: return from a call to get_bits1
    681.     return get_bits(s, 1);
    682. #endif
    683. }
         ^
    684. 
    685. static inline unsigned int show_bits1(GetBitContext *s){

libavformat/mpc8.c:65:11: Loop condition is true. Entering loop body
  63.     int64_t v = 0;
  64.     int bits = 0;
  65.     while(get_bits1(gb) && bits < 64-7){
                ^
  66.         v <<= 7;
  67.         v |= get_bits(gb, 7);

libavformat/mpc8.c:65:28: Loop condition is true. Entering loop body
  63.     int64_t v = 0;
  64.     int bits = 0;
  65.     while(get_bits1(gb) && bits < 64-7){
                                 ^
  66.         v <<= 7;
  67.         v |= get_bits(gb, 7);

libavformat/mpc8.c:66:9: 
  64.     int bits = 0;
  65.     while(get_bits1(gb) && bits < 64-7){
  66.         v <<= 7;
              ^
  67.         v |= get_bits(gb, 7);
  68.         bits += 7;

libavformat/mpc8.c:67:9: 
  65.     while(get_bits1(gb) && bits < 64-7){
  66.         v <<= 7;
  67.         v |= get_bits(gb, 7);
              ^
  68.         bits += 7;
  69.     }

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

libavcodec/bitstream.h:636:5: 
    634. static inline unsigned int get_bits(GetBitContext *s, int n){
    635.     register int tmp;
    636.     OPEN_READER(re, s)
             ^
    637.     UPDATE_CACHE(re, s)
    638.     tmp= SHOW_UBITS(re, s, n);

libavcodec/bitstream.h:637:5: 
    635.     register int tmp;
    636.     OPEN_READER(re, s)
    637.     UPDATE_CACHE(re, s)
             ^
    638.     tmp= SHOW_UBITS(re, s, n);
    639.     LAST_SKIP_BITS(re, s, n)

libavcodec/bitstream.h:638:5: 
    636.     OPEN_READER(re, s)
    637.     UPDATE_CACHE(re, s)
    638.     tmp= SHOW_UBITS(re, s, n);
             ^
    639.     LAST_SKIP_BITS(re, s, n)
    640.     CLOSE_READER(re, s)

libavcodec/bitstream.h:639:5: 
    637.     UPDATE_CACHE(re, s)
    638.     tmp= SHOW_UBITS(re, s, n);
    639.     LAST_SKIP_BITS(re, s, n)
             ^
    640.     CLOSE_READER(re, s)
    641.     return tmp;

libavcodec/bitstream.h:640:5: 
    638.     tmp= SHOW_UBITS(re, s, n);
    639.     LAST_SKIP_BITS(re, s, n)
    640.     CLOSE_READER(re, s)
             ^
    641.     return tmp;
    642. }

libavcodec/bitstream.h:641:5: 
    639.     LAST_SKIP_BITS(re, s, n)
    640.     CLOSE_READER(re, s)
    641.     return tmp;
             ^
    642. }
    643. 

libavcodec/bitstream.h:642:1: return from a call to get_bits
    640.     CLOSE_READER(re, s)
    641.     return tmp;
    642. }
         ^
    643. 
    644. /**

libavformat/mpc8.c:68:9: 
  66.         v <<= 7;
  67.         v |= get_bits(gb, 7);
  68.         bits += 7;
              ^
  69.     }
  70.     v <<= 7;

libavformat/mpc8.c:65:11: 
  63.     int64_t v = 0;
  64.     int bits = 0;
  65.     while(get_bits1(gb) && bits < 64-7){
                ^
  66.         v <<= 7;
  67.         v |= get_bits(gb, 7);

libavcodec/bitstream.h:665:1: start of procedure get_bits1()
    663. }
    664. 
    665. static inline unsigned int get_bits1(GetBitContext *s){
         ^
    666. #ifdef ALT_BITSTREAM_READER
    667.     int index= s->index;

libavcodec/bitstream.h:667:5: 
    665. static inline unsigned int get_bits1(GetBitContext *s){
    666. #ifdef ALT_BITSTREAM_READER
    667.     int index= s->index;
             ^
    668.     uint8_t result= s->buffer[ index>>3 ];
    669. #ifdef ALT_BITSTREAM_READER_LE

libavcodec/bitstream.h:668:5: 
    666. #ifdef ALT_BITSTREAM_READER
    667.     int index= s->index;
    668.     uint8_t result= s->buffer[ index>>3 ];
             ^
    669. #ifdef ALT_BITSTREAM_READER_LE
    670.     result>>= (index&0x07);
