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:9: Taking false branch
  64.     ((char*)ptr)[-1]= diff;
  65. #elif HAVE_POSIX_MEMALIGN
  66.     if (posix_memalign(&ptr,16,size))
              ^
  67.         ptr = NULL;
  68. #elif HAVE_MEMALIGN

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

libavutil/mem.c:100:1: return from a call to av_malloc
   98. #endif
   99.     return ptr;
  100. }
       ^
  101. 
  102. 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/get_bits.h:493:1: start of procedure init_get_bits()
  491.  * @param bit_size the size of the buffer in bits
  492.  */
  493. static inline void init_get_bits(GetBitContext *s,
       ^
  494.                    const uint8_t *buffer, int bit_size)
  495. {

libavcodec/get_bits.h:496:5: 
  494.                    const uint8_t *buffer, int bit_size)
  495. {
  496.     int buffer_size= (bit_size+7)>>3;
           ^
  497.     if(buffer_size < 0 || bit_size < 0) {
  498.         buffer_size = bit_size = 0;

libavcodec/get_bits.h:497:8: Taking true branch
  495. {
  496.     int buffer_size= (bit_size+7)>>3;
  497.     if(buffer_size < 0 || bit_size < 0) {
              ^
  498.         buffer_size = bit_size = 0;
  499.         buffer = NULL;

libavcodec/get_bits.h:498:9: 
  496.     int buffer_size= (bit_size+7)>>3;
  497.     if(buffer_size < 0 || bit_size < 0) {
  498.         buffer_size = bit_size = 0;
               ^
  499.         buffer = NULL;
  500.     }

libavcodec/get_bits.h:499:9: 
  497.     if(buffer_size < 0 || bit_size < 0) {
  498.         buffer_size = bit_size = 0;
  499.         buffer = NULL;
               ^
  500.     }
  501. 

libavcodec/get_bits.h:502:5: 
  500.     }
  501. 
  502.     s->buffer= buffer;
           ^
  503.     s->size_in_bits= bit_size;
  504.     s->buffer_end= buffer + buffer_size;

libavcodec/get_bits.h:503:5: 
  501. 
  502.     s->buffer= buffer;
  503.     s->size_in_bits= bit_size;
           ^
  504.     s->buffer_end= buffer + buffer_size;
  505. #ifdef ALT_BITSTREAM_READER

libavcodec/get_bits.h:504:5: 
  502.     s->buffer= buffer;
  503.     s->size_in_bits= bit_size;
  504.     s->buffer_end= buffer + buffer_size;
           ^
  505. #ifdef ALT_BITSTREAM_READER
  506.     s->index=0;

libavcodec/get_bits.h:506:5: 
  504.     s->buffer_end= buffer + buffer_size;
  505. #ifdef ALT_BITSTREAM_READER
  506.     s->index=0;
           ^
  507. #elif defined LIBMPEG2_BITSTREAM_READER
  508.     s->buffer_ptr = (uint8_t*)((intptr_t)buffer&(~1));

libavcodec/get_bits.h:516:1: return from a call to init_get_bits
  514.     skip_bits_long(s, 0);
  515. #endif
  516. }
       ^
  517. 
  518. 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/get_bits.h:416:1: start of procedure get_bits1()
    414. }
    415. 
    416. static inline unsigned int get_bits1(GetBitContext *s){
         ^
    417. #ifdef ALT_BITSTREAM_READER
    418.     int index= s->index;

libavcodec/get_bits.h:418:5: 
    416. static inline unsigned int get_bits1(GetBitContext *s){
    417. #ifdef ALT_BITSTREAM_READER
    418.     int index= s->index;
             ^
    419.     uint8_t result= s->buffer[ index>>3 ];
    420. #ifdef ALT_BITSTREAM_READER_LE

libavcodec/get_bits.h:419:5: 
    417. #ifdef ALT_BITSTREAM_READER
    418.     int index= s->index;
    419.     uint8_t result= s->buffer[ index>>3 ];
             ^
    420. #ifdef ALT_BITSTREAM_READER_LE
    421.     result>>= (index&0x07);

libavcodec/get_bits.h:424:5: 
    422.     result&= 1;
    423. #else
    424.     result<<= (index&0x07);
             ^
    425.     result>>= 8 - 1;
    426. #endif

libavcodec/get_bits.h:425:5: 
    423. #else
    424.     result<<= (index&0x07);
    425.     result>>= 8 - 1;
             ^
    426. #endif
    427.     index++;

libavcodec/get_bits.h:427:5: 
    425.     result>>= 8 - 1;
    426. #endif
    427.     index++;
             ^
    428.     s->index= index;
    429. 

libavcodec/get_bits.h:428:5: 
    426. #endif
    427.     index++;
    428.     s->index= index;
             ^
    429. 
    430.     return result;

libavcodec/get_bits.h:430:5: 
    428.     s->index= index;
    429. 
    430.     return result;
             ^
    431. #else
    432.     return get_bits(s, 1);

libavcodec/get_bits.h:434:1: return from a call to get_bits1
    432.     return get_bits(s, 1);
    433. #endif
    434. }
         ^
    435. 
    436. 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/get_bits.h:385:1: start of procedure get_bits()
    383.  * Note, the alt bitstream reader can read up to 25 bits, but the libmpeg2 reader can't
    384.  */
    385. static inline unsigned int get_bits(GetBitContext *s, int n){
         ^
    386.     register int tmp;
    387.     OPEN_READER(re, s)

libavcodec/get_bits.h:387:5: 
    385. static inline unsigned int get_bits(GetBitContext *s, int n){
    386.     register int tmp;
    387.     OPEN_READER(re, s)
             ^
    388.     UPDATE_CACHE(re, s)
    389.     tmp= SHOW_UBITS(re, s, n);

libavcodec/get_bits.h:388:5: 
    386.     register int tmp;
    387.     OPEN_READER(re, s)
    388.     UPDATE_CACHE(re, s)
             ^
    389.     tmp= SHOW_UBITS(re, s, n);
    390.     LAST_SKIP_BITS(re, s, n)

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. 

libavcodec/get_bits.h:389:5: 
    387.     OPEN_READER(re, s)
    388.     UPDATE_CACHE(re, s)
    389.     tmp= SHOW_UBITS(re, s, n);
             ^
    390.     LAST_SKIP_BITS(re, s, n)
    391.     CLOSE_READER(re, s)

libavcodec/get_bits.h:390:5: 
    388.     UPDATE_CACHE(re, s)
    389.     tmp= SHOW_UBITS(re, s, n);
    390.     LAST_SKIP_BITS(re, s, n)
             ^
    391.     CLOSE_READER(re, s)
    392.     return tmp;

libavcodec/get_bits.h:391:5: 
    389.     tmp= SHOW_UBITS(re, s, n);
    390.     LAST_SKIP_BITS(re, s, n)
    391.     CLOSE_READER(re, s)
             ^
    392.     return tmp;
    393. }

libavcodec/get_bits.h:392:5: 
    390.     LAST_SKIP_BITS(re, s, n)
    391.     CLOSE_READER(re, s)
    392.     return tmp;
             ^
    393. }
    394. 

libavcodec/get_bits.h:393:1: return from a call to get_bits
    391.     CLOSE_READER(re, s)
    392.     return tmp;
    393. }
         ^
    394. 
    395. /**

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/get_bits.h:416:1: start of procedure get_bits1()
    414. }
    415. 
    416. static inline unsigned int get_bits1(GetBitContext *s){
         ^
    417. #ifdef ALT_BITSTREAM_READER
    418.     int index= s->index;

libavcodec/get_bits.h:418:5: 
    416. static inline unsigned int get_bits1(GetBitContext *s){
    417. #ifdef ALT_BITSTREAM_READER
    418.     int index= s->index;
             ^
    419.     uint8_t result= s->buffer[ index>>3 ];
    420. #ifdef ALT_BITSTREAM_READER_LE

libavcodec/get_bits.h:419:5: 
    417. #ifdef ALT_BITSTREAM_READER
    418.     int index= s->index;
    419.     uint8_t result= s->buffer[ index>>3 ];
             ^
    420. #ifdef ALT_BITSTREAM_READER_LE
    421.     result>>= (index&0x07);

libavcodec/get_bits.h:424:5: 
    422.     result&= 1;
    423. #else
    424.     result<<= (index&0x07);
             ^
    425.     result>>= 8 - 1;
    426. #endif

libavcodec/get_bits.h:425:5: 
    423. #else
    424.     result<<= (index&0x07);
    425.     result>>= 8 - 1;
             ^
    426. #endif
    427.     index++;

libavcodec/get_bits.h:427:5: 
    425.     result>>= 8 - 1;
    426. #endif
    427.     index++;
             ^
    428.     s->index= index;
    429. 

libavcodec/get_bits.h:428:5: 
    426. #endif
    427.     index++;
    428.     s->index= index;
             ^
    429. 
    430.     return result;

libavcodec/get_bits.h:430:5: 
    428.     s->index= index;
    429. 
    430.     return result;
             ^
    431. #else
    432.     return get_bits(s, 1);

libavcodec/get_bits.h:434:1: return from a call to get_bits1
    432.     return get_bits(s, 1);
    433. #endif
    434. }
         ^
    435. 
    436. 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/get_bits.h:385:1: start of procedure get_bits()
    383.  * Note, the alt bitstream reader can read up to 25 bits, but the libmpeg2 reader can't
    384.  */
    385. static inline unsigned int get_bits(GetBitContext *s, int n){
         ^
    386.     register int tmp;
    387.     OPEN_READER(re, s)

libavcodec/get_bits.h:387:5: 
    385. static inline unsigned int get_bits(GetBitContext *s, int n){
    386.     register int tmp;
    387.     OPEN_READER(re, s)
             ^
    388.     UPDATE_CACHE(re, s)
    389.     tmp= SHOW_UBITS(re, s, n);

libavcodec/get_bits.h:388:5: 
    386.     register int tmp;
    387.     OPEN_READER(re, s)
    388.     UPDATE_CACHE(re, s)
             ^
    389.     tmp= SHOW_UBITS(re, s, n);
    390.     LAST_SKIP_BITS(re, s, n)

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. 

libavcodec/get_bits.h:389:5: 
    387.     OPEN_READER(re, s)
    388.     UPDATE_CACHE(re, s)
    389.     tmp= SHOW_UBITS(re, s, n);
             ^
    390.     LAST_SKIP_BITS(re, s, n)
    391.     CLOSE_READER(re, s)

libavcodec/get_bits.h:390:5: 
    388.     UPDATE_CACHE(re, s)
    389.     tmp= SHOW_UBITS(re, s, n);
    390.     LAST_SKIP_BITS(re, s, n)
             ^
    391.     CLOSE_READER(re, s)
    392.     return tmp;

libavcodec/get_bits.h:391:5: 
    389.     tmp= SHOW_UBITS(re, s, n);
    390.     LAST_SKIP_BITS(re, s, n)
    391.     CLOSE_READER(re, s)
             ^
    392.     return tmp;
    393. }

libavcodec/get_bits.h:392:5: 
    390.     LAST_SKIP_BITS(re, s, n)
    391.     CLOSE_READER(re, s)
    392.     return tmp;
             ^
    393. }
    394. 

libavcodec/get_bits.h:393:1: return from a call to get_bits
    391.     CLOSE_READER(re, s)
    392.     return tmp;
    393. }
         ^
    394. 
    395. /**

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/get_bits.h:416:1: start of procedure get_bits1()
    414. }
    415. 
    416. static inline unsigned int get_bits1(GetBitContext *s){
         ^
    417. #ifdef ALT_BITSTREAM_READER
    418.     int index= s->index;

libavcodec/get_bits.h:418:5: 
    416. static inline unsigned int get_bits1(GetBitContext *s){
    417. #ifdef ALT_BITSTREAM_READER
    418.     int index= s->index;
             ^
    419.     uint8_t result= s->buffer[ index>>3 ];
    420. #ifdef ALT_BITSTREAM_READER_LE

libavcodec/get_bits.h:419:5: 
    417. #ifdef ALT_BITSTREAM_READER
    418.     int index= s->index;
    419.     uint8_t result= s->buffer[ index>>3 ];
             ^
    420. #ifdef ALT_BITSTREAM_READER_LE
    421.     result>>= (index&0x07);

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;
    url_fseek(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)))
        return;
    get_buffer(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    url_fseek(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)))\n        return;\n    get_buffer(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(unsigned int size)\n{\n    void *ptr = NULL;\n#if CONFIG_MEMALIGN_HACK\n    long diff;\n#endif\n    if(size > (INT_MAX-16) )\n        return NULL;\n#if CONFIG_MEMALIGN_HACK\n    ptr = malloc(size+16);\n    if(!ptr)\n        return ptr;\n    diff= ((-(long)ptr - 1)&15) + 1;\n    ptr = (char*)ptr + diff;\n    ((char*)ptr)[-1]= diff;\n#elif HAVE_POSIX_MEMALIGN\n    if (posix_memalign(&ptr,16,size))\n        ptr = NULL;\n#elif HAVE_MEMALIGN\n    ptr = memalign(16,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 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 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    int index= s->index;\n    uint8_t result= s->buffer[ index>>3 ];\n#ifdef ALT_BITSTREAM_READER_LE\n    result>>= (index&0x07);\n    result&= 1;\n#else\n    result<<= (index&0x07);\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 bswap_32(uint32_t x)\n{\n    x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);\n    x= (x>>16) | (x<<16);\n    return x;\n}']