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

libavformat/mpc8.c:131:1: start of procedure mpc8_parse_seektable()
129. }
130. 
131. static void mpc8_parse_seektable(AVFormatContext *s, int64_t off)
     ^
132. {
133.     MPCContext *c = s->priv_data;

libavformat/mpc8.c:133:5: 
131. static void mpc8_parse_seektable(AVFormatContext *s, int64_t off)
132. {
133.     MPCContext *c = s->priv_data;
         ^
134.     int tag;
135.     int64_t size, pos, ppos[2];

libavformat/mpc8.c:140:5: Skipping avio_seek(): empty list of specs
138.     GetBitContext gb;
139. 
140.     avio_seek(s->pb, off, SEEK_SET);
         ^
141.     mpc8_get_chunk_header(s->pb, &tag, &size);
142.     if(tag != TAG_SEEKTABLE){

libavformat/mpc8.c:141:5: Skipping mpc8_get_chunk_header(): empty list of specs
139. 
140.     avio_seek(s->pb, off, SEEK_SET);
141.     mpc8_get_chunk_header(s->pb, &tag, &size);
         ^
142.     if(tag != TAG_SEEKTABLE){
143.         av_log(s, AV_LOG_ERROR, "No seek table at given position\n");

libavformat/mpc8.c:142:8: Taking false branch
140.     avio_seek(s->pb, off, SEEK_SET);
141.     mpc8_get_chunk_header(s->pb, &tag, &size);
142.     if(tag != TAG_SEEKTABLE){
            ^
143.         av_log(s, AV_LOG_ERROR, "No seek table at given position\n");
144.         return;

libavformat/mpc8.c:146:10: 
144.         return;
145.     }
146.     if(!(buf = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE)))
              ^
147.         return;
148.     avio_read(s->pb, buf, size);

libavutil/mem.c:64:1: start of procedure av_malloc()
  62.    linker will do it automatically. */
  63. 
  64. void *av_malloc(size_t size)
      ^
  65. {
  66.     void *ptr = NULL;

libavutil/mem.c:66:5: 
  64. void *av_malloc(size_t size)
  65. {
  66.     void *ptr = NULL;
          ^
  67. #if CONFIG_MEMALIGN_HACK
  68.     long diff;

libavutil/mem.c:72:8: Taking false branch
  70. 
  71.     /* let's disallow possible ambiguous cases */
  72.     if(size > (INT_MAX-32) )
             ^
  73.         return NULL;
  74. 

libavutil/mem.c:83:9: Taking false branch
  81.     ((char*)ptr)[-1]= diff;
  82. #elif HAVE_POSIX_MEMALIGN
  83.     if (posix_memalign(&ptr,32,size))
              ^
  84.         ptr = NULL;
  85. #elif HAVE_MEMALIGN

libavutil/mem.c:114:5: 
  112.     ptr = malloc(size);
  113. #endif
  114.     return ptr;
           ^
  115. }
  116. 

libavutil/mem.c:115:1: return from a call to av_malloc
  113. #endif
  114.     return ptr;
  115. }
       ^
  116. 
  117. void *av_realloc(void *ptr, size_t size)

libavformat/mpc8.c:146:10: Taking false branch
144.         return;
145.     }
146.     if(!(buf = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE)))
              ^
147.         return;
148.     avio_read(s->pb, buf, size);

libavformat/mpc8.c:148:5: Skipping avio_read(): empty list of specs
146.     if(!(buf = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE)))
147.         return;
148.     avio_read(s->pb, buf, size);
         ^
149.     init_get_bits(&gb, buf, size * 8);
150.     size = gb_get_v(&gb);

libavformat/mpc8.c:149:5: 
147.         return;
148.     avio_read(s->pb, buf, size);
149.     init_get_bits(&gb, buf, size * 8);
         ^
150.     size = gb_get_v(&gb);
151.     if(size > UINT_MAX/4 || size > c->samples/1152){

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)

libavformat/mpc8.c:150:5: 
148.     avio_read(s->pb, buf, size);
149.     init_get_bits(&gb, buf, size * 8);
150.     size = gb_get_v(&gb);
         ^
151.     if(size > UINT_MAX/4 || size > c->samples/1152){
152.         av_log(s, AV_LOG_ERROR, "Seek table is too big\n");

libavformat/mpc8.c:107:1: start of procedure gb_get_v()
  105. }
  106. 
  107. static inline int64_t gb_get_v(GetBitContext *gb)
       ^
  108. {
  109.     int64_t v = 0;

libavformat/mpc8.c:109:5: 
  107. static inline int64_t gb_get_v(GetBitContext *gb)
  108. {
  109.     int64_t v = 0;
           ^
  110.     int bits = 0;
  111.     while(get_bits1(gb) && bits < 64-7){

libavformat/mpc8.c:110:5: 
  108. {
  109.     int64_t v = 0;
  110.     int bits = 0;
           ^
  111.     while(get_bits1(gb) && bits < 64-7){
  112.         v <<= 7;

libavformat/mpc8.c:111:11: 
  109.     int64_t v = 0;
  110.     int bits = 0;
  111.     while(get_bits1(gb) && bits < 64-7){
                 ^
  112.         v <<= 7;
  113.         v |= get_bits(gb, 7);

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;

libavcodec/get_bits.h:308:5: 
    306.     uint8_t result = s->buffer[index>>3];
    307. #ifdef ALT_BITSTREAM_READER_LE
    308.     result >>= index & 7;
             ^
    309.     result &= 1;
    310. #else

libavcodec/get_bits.h:309:5: 
    307. #ifdef ALT_BITSTREAM_READER_LE
    308.     result >>= index & 7;
    309.     result &= 1;
             ^
    310. #else
    311.     result <<= index & 7;

libavcodec/get_bits.h:314:5: 
    312.     result >>= 8 - 1;
    313. #endif
    314.     index++;
             ^
    315.     s->index = index;
    316. 

libavcodec/get_bits.h:315:5: 
    313. #endif
    314.     index++;
    315.     s->index = index;
             ^
    316. 
    317.     return result;

libavcodec/get_bits.h:317:5: 
    315.     s->index = index;
    316. 
    317.     return result;
             ^
    318. #else
    319.     return get_bits(s, 1);

libavcodec/get_bits.h:321:1: return from a call to get_bits1
    319.     return get_bits(s, 1);
    320. #endif
    321. }
         ^
    322. 
    323. static inline unsigned int show_bits1(GetBitContext *s){

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

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

libavformat/mpc8.c:112:9: 
  110.     int bits = 0;
  111.     while(get_bits1(gb) && bits < 64-7){
  112.         v <<= 7;
               ^
  113.         v |= get_bits(gb, 7);
  114.         bits += 7;

libavformat/mpc8.c:113:9: 
  111.     while(get_bits1(gb) && bits < 64-7){
  112.         v <<= 7;
  113.         v |= get_bits(gb, 7);
               ^
  114.         bits += 7;
  115.     }

libavcodec/get_bits.h:274:1: start of procedure get_bits()
    272.  * Read 1-25 bits.
    273.  */
    274. static inline unsigned int get_bits(GetBitContext *s, int n){
         ^
    275.     register int tmp;
    276.     OPEN_READER(re, s);

libavcodec/get_bits.h:276:5: 
    274. static inline unsigned int get_bits(GetBitContext *s, int n){
    275.     register int tmp;
    276.     OPEN_READER(re, s);
             ^
    277.     UPDATE_CACHE(re, s);
    278.     tmp = SHOW_UBITS(re, s, n);

libavcodec/get_bits.h:277:5: 
    275.     register int tmp;
    276.     OPEN_READER(re, s);
    277.     UPDATE_CACHE(re, s);
             ^
    278.     tmp = SHOW_UBITS(re, s, n);
    279.     LAST_SKIP_BITS(re, s, n);

libavutil/bswap.h:66:1: start of procedure av_bswap32()
      64. 
      65. #ifndef av_bswap32
      66. static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
          ^
      67. {
      68.     x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);

libavutil/bswap.h:68:5: 
      66. static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
      67. {
      68.     x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);
              ^
      69.     x= (x>>16) | (x<<16);
      70.     return x;

libavutil/bswap.h:69:5: 
      67. {
      68.     x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);
      69.     x= (x>>16) | (x<<16);
              ^
      70.     return x;
      71. }

libavutil/bswap.h:70:5: 
      68.     x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);
      69.     x= (x>>16) | (x<<16);
      70.     return x;
              ^
      71. }
      72. #endif

libavutil/bswap.h:71:1: return from a call to av_bswap32
      69.     x= (x>>16) | (x<<16);
      70.     return x;
      71. }
          ^
      72. #endif
      73. 

libavcodec/get_bits.h:278:5: 
    276.     OPEN_READER(re, s);
    277.     UPDATE_CACHE(re, s);
    278.     tmp = SHOW_UBITS(re, s, n);
             ^
    279.     LAST_SKIP_BITS(re, s, n);
    280.     CLOSE_READER(re, s);

libavcodec/get_bits.h:279:5: 
    277.     UPDATE_CACHE(re, s);
    278.     tmp = SHOW_UBITS(re, s, n);
    279.     LAST_SKIP_BITS(re, s, n);
             ^
    280.     CLOSE_READER(re, s);
    281.     return tmp;

libavcodec/get_bits.h:280:5: 
    278.     tmp = SHOW_UBITS(re, s, n);
    279.     LAST_SKIP_BITS(re, s, n);
    280.     CLOSE_READER(re, s);
             ^
    281.     return tmp;
    282. }

libavcodec/get_bits.h:281:5: 
    279.     LAST_SKIP_BITS(re, s, n);
    280.     CLOSE_READER(re, s);
    281.     return tmp;
             ^
    282. }
    283. 

libavcodec/get_bits.h:282:1: return from a call to get_bits
    280.     CLOSE_READER(re, s);
    281.     return tmp;
    282. }
         ^
    283. 
    284. /**

libavformat/mpc8.c:114:9: 
  112.         v <<= 7;
  113.         v |= get_bits(gb, 7);
  114.         bits += 7;
               ^
  115.     }
  116.     v <<= 7;

libavformat/mpc8.c:111:11: 
  109.     int64_t v = 0;
  110.     int bits = 0;
  111.     while(get_bits1(gb) && bits < 64-7){
                 ^
  112.         v <<= 7;
  113.         v |= get_bits(gb, 7);

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;

libavcodec/get_bits.h:308:5: 
    306.     uint8_t result = s->buffer[index>>3];
    307. #ifdef ALT_BITSTREAM_READER_LE
    308.     result >>= index & 7;
             ^
    309.     result &= 1;
    310. #else

libavcodec/get_bits.h:309:5: 
    307. #ifdef ALT_BITSTREAM_READER_LE
    308.     result >>= index & 7;
    309.     result &= 1;
             ^
    310. #else
    311.     result <<= index & 7;

libavcodec/get_bits.h:314:5: 
    312.     result >>= 8 - 1;
    313. #endif
    314.     index++;
             ^
    315.     s->index = index;
    316. 

libavcodec/get_bits.h:315:5: 
    313. #endif
    314.     index++;
    315.     s->index = index;
             ^
    316. 
    317.     return result;

libavcodec/get_bits.h:317:5: 
    315.     s->index = index;
    316. 
    317.     return result;
             ^
    318. #else
    319.     return get_bits(s, 1);

libavcodec/get_bits.h:321:1: return from a call to get_bits1
    319.     return get_bits(s, 1);
    320. #endif
    321. }
         ^
    322. 
    323. static inline unsigned int show_bits1(GetBitContext *s){

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

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

libavformat/mpc8.c:112:9: 
  110.     int bits = 0;
  111.     while(get_bits1(gb) && bits < 64-7){
  112.         v <<= 7;
               ^
  113.         v |= get_bits(gb, 7);
  114.         bits += 7;

libavformat/mpc8.c:113:9: 
  111.     while(get_bits1(gb) && bits < 64-7){
  112.         v <<= 7;
  113.         v |= get_bits(gb, 7);
               ^
  114.         bits += 7;
  115.     }

libavcodec/get_bits.h:274:1: start of procedure get_bits()
    272.  * Read 1-25 bits.
    273.  */
    274. static inline unsigned int get_bits(GetBitContext *s, int n){
         ^
    275.     register int tmp;
    276.     OPEN_READER(re, s);

libavcodec/get_bits.h:276:5: 
    274. static inline unsigned int get_bits(GetBitContext *s, int n){
    275.     register int tmp;
    276.     OPEN_READER(re, s);
             ^
    277.     UPDATE_CACHE(re, s);
    278.     tmp = SHOW_UBITS(re, s, n);

libavcodec/get_bits.h:277:5: 
    275.     register int tmp;
    276.     OPEN_READER(re, s);
    277.     UPDATE_CACHE(re, s);
             ^
    278.     tmp = SHOW_UBITS(re, s, n);
    279.     LAST_SKIP_BITS(re, s, n);

libavutil/bswap.h:66:1: start of procedure av_bswap32()
      64. 
      65. #ifndef av_bswap32
      66. static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
          ^
      67. {
      68.     x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);

libavutil/bswap.h:68:5: 
      66. static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
      67. {
      68.     x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);
              ^
      69.     x= (x>>16) | (x<<16);
      70.     return x;

libavutil/bswap.h:69:5: 
      67. {
      68.     x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);
      69.     x= (x>>16) | (x<<16);
              ^
      70.     return x;
      71. }

libavutil/bswap.h:70:5: 
      68.     x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);
      69.     x= (x>>16) | (x<<16);
      70.     return x;
              ^
      71. }
      72. #endif

libavutil/bswap.h:71:1: return from a call to av_bswap32
      69.     x= (x>>16) | (x<<16);
      70.     return x;
      71. }
          ^
      72. #endif
      73. 

libavcodec/get_bits.h:278:5: 
    276.     OPEN_READER(re, s);
    277.     UPDATE_CACHE(re, s);
    278.     tmp = SHOW_UBITS(re, s, n);
             ^
    279.     LAST_SKIP_BITS(re, s, n);
    280.     CLOSE_READER(re, s);

libavcodec/get_bits.h:279:5: 
    277.     UPDATE_CACHE(re, s);
    278.     tmp = SHOW_UBITS(re, s, n);
    279.     LAST_SKIP_BITS(re, s, n);
             ^
    280.     CLOSE_READER(re, s);
    281.     return tmp;

libavcodec/get_bits.h:280:5: 
    278.     tmp = SHOW_UBITS(re, s, n);
    279.     LAST_SKIP_BITS(re, s, n);
    280.     CLOSE_READER(re, s);
             ^
    281.     return tmp;
    282. }

libavcodec/get_bits.h:281:5: 
    279.     LAST_SKIP_BITS(re, s, n);
    280.     CLOSE_READER(re, s);
    281.     return tmp;
             ^
    282. }
    283. 

libavcodec/get_bits.h:282:1: return from a call to get_bits
    280.     CLOSE_READER(re, s);
    281.     return tmp;
    282. }
         ^
    283. 
    284. /**

libavformat/mpc8.c:114:9: 
  112.         v <<= 7;
  113.         v |= get_bits(gb, 7);
  114.         bits += 7;
               ^
  115.     }
  116.     v <<= 7;

libavformat/mpc8.c:111:11: 
  109.     int64_t v = 0;
  110.     int bits = 0;
  111.     while(get_bits1(gb) && bits < 64-7){
                 ^
  112.         v <<= 7;
  113.         v |= get_bits(gb, 7);

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 void mpc8_parse_seektable(AVFormatContext *s, int64_t off)
{
    MPCContext *c = s->priv_data;
    int tag;
    int64_t size, pos, ppos[2];
    uint8_t *buf;
    int i, t, seekd;
    GetBitContext gb;
    avio_seek(s->pb, off, SEEK_SET);
    mpc8_get_chunk_header(s->pb, &tag, &size);
    if(tag != TAG_SEEKTABLE){
        av_log(s, AV_LOG_ERROR, "No seek table at given position\n");
        return;
    }
    if(!(buf = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE)))
        return;
    avio_read(s->pb, buf, size);
    init_get_bits(&gb, buf, size * 8);
    size = gb_get_v(&gb);
    if(size > UINT_MAX/4 || size > c->samples/1152){
        av_log(s, AV_LOG_ERROR, "Seek table is too big\n");
        return;
    }
    seekd = get_bits(&gb, 4);
    for(i = 0; i < 2; i++){
        pos = gb_get_v(&gb) + c->header_pos;
        ppos[1 - i] = pos;
        av_add_index_entry(s->streams[0], pos, i, 0, 0, AVINDEX_KEYFRAME);
    }
    for(; i < size; i++){
        t = get_unary(&gb, 1, 33) << 12;
        t += get_bits(&gb, 12);
        if(t & 1)
            t = -(t & ~1);
        pos = (t >> 1) + ppos[0]*2 - ppos[1];
        av_add_index_entry(s->streams[0], pos, i << seekd, 0, 0, AVINDEX_KEYFRAME);
        ppos[1] = ppos[0];
        ppos[0] = pos;
    }
    av_free(buf);
}
['static void mpc8_parse_seektable(AVFormatContext *s, int64_t off)\n{\n    MPCContext *c = s->priv_data;\n    int tag;\n    int64_t size, pos, ppos[2];\n    uint8_t *buf;\n    int i, t, seekd;\n    GetBitContext gb;\n    avio_seek(s->pb, off, SEEK_SET);\n    mpc8_get_chunk_header(s->pb, &tag, &size);\n    if(tag != TAG_SEEKTABLE){\n        av_log(s, AV_LOG_ERROR, "No seek table at given position\\n");\n        return;\n    }\n    if(!(buf = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE)))\n        return;\n    avio_read(s->pb, buf, size);\n    init_get_bits(&gb, buf, size * 8);\n    size = gb_get_v(&gb);\n    if(size > UINT_MAX/4 || size > c->samples/1152){\n        av_log(s, AV_LOG_ERROR, "Seek table is too big\\n");\n        return;\n    }\n    seekd = get_bits(&gb, 4);\n    for(i = 0; i < 2; i++){\n        pos = gb_get_v(&gb) + c->header_pos;\n        ppos[1 - i] = pos;\n        av_add_index_entry(s->streams[0], pos, i, 0, 0, AVINDEX_KEYFRAME);\n    }\n    for(; i < size; i++){\n        t = get_unary(&gb, 1, 33) << 12;\n        t += get_bits(&gb, 12);\n        if(t & 1)\n            t = -(t & ~1);\n        pos = (t >> 1) + ppos[0]*2 - ppos[1];\n        av_add_index_entry(s->streams[0], pos, i << seekd, 0, 0, AVINDEX_KEYFRAME);\n        ppos[1] = ppos[0];\n        ppos[0] = pos;\n    }\n    av_free(buf);\n}', 'void *av_malloc(size_t size)\n{\n    void *ptr = NULL;\n#if CONFIG_MEMALIGN_HACK\n    long diff;\n#endif\n    if(size > (INT_MAX-32) )\n        return NULL;\n#if CONFIG_MEMALIGN_HACK\n    ptr = malloc(size+32);\n    if(!ptr)\n        return ptr;\n    diff= ((-(long)ptr - 1)&31) + 1;\n    ptr = (char*)ptr + diff;\n    ((char*)ptr)[-1]= diff;\n#elif HAVE_POSIX_MEMALIGN\n    if (posix_memalign(&ptr,32,size))\n        ptr = NULL;\n#elif HAVE_MEMALIGN\n    ptr = memalign(32,size);\n#else\n    ptr = malloc(size);\n#endif\n    return ptr;\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 int64_t gb_get_v(GetBitContext *gb)\n{\n    int64_t v = 0;\n    int bits = 0;\n    while(get_bits1(gb) && bits < 64-7){\n        v <<= 7;\n        v |= get_bits(gb, 7);\n        bits += 7;\n    }\n    v <<= 7;\n    v |= get_bits(gb, 7);\n    return v;\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}', '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}', 'static av_always_inline av_const uint32_t av_bswap32(uint32_t x)\n{\n    x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);\n    x= (x>>16) | (x<<16);\n    return x;\n}']