libavcodec/dvdsubdec.c:99: error: Null Dereference
  pointer `&gb->buffer` last assigned on line 90 could be null and is dereferenced by call to `decode_run_8bit()` at line 99, column 19.

libavcodec/dvdsubdec.c:81:1: start of procedure decode_rle()
79. }
80. 
81. static int decode_rle(uint8_t *bitmap, int linesize, int w, int h,
    ^
82.                       const uint8_t *buf, int start, int buf_size, int is_8bit)
83. {

libavcodec/dvdsubdec.c:89:5: 
87.     uint8_t *d;
88. 
89.     bit_len = (buf_size - start) * 8;
        ^
90.     init_get_bits(&gb, buf + start, bit_len);
91. 

libavcodec/dvdsubdec.c:90:5: 
88. 
89.     bit_len = (buf_size - start) * 8;
90.     init_get_bits(&gb, buf + start, bit_len);
        ^
91. 
92.     x = 0;

libavcodec/get_bits.h:496:1: start of procedure init_get_bits()
  494.  * responsible for checking for the buffer end yourself (take advantage of the padding)!
  495.  */
  496. static inline void init_get_bits(GetBitContext *s,
       ^
  497.                    const uint8_t *buffer, int bit_size)
  498. {

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

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

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

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

libavcodec/get_bits.h:505:5: 
  503.     }
  504. 
  505.     s->buffer= buffer;
           ^
  506.     s->size_in_bits= bit_size;
  507.     s->buffer_end= buffer + buffer_size;

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

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

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

libavcodec/get_bits.h:519:1: return from a call to init_get_bits
  517.     skip_bits_long(s, 0);
  518. #endif
  519. }
       ^
  520. 
  521. static inline void align_get_bits(GetBitContext *s)

libavcodec/dvdsubdec.c:92:5: 
90.     init_get_bits(&gb, buf + start, bit_len);
91. 
92.     x = 0;
        ^
93.     y = 0;
94.     d = bitmap;

libavcodec/dvdsubdec.c:93:5: 
91. 
92.     x = 0;
93.     y = 0;
        ^
94.     d = bitmap;
95.     for(;;) {

libavcodec/dvdsubdec.c:94:5: 
92.     x = 0;
93.     y = 0;
94.     d = bitmap;
        ^
95.     for(;;) {
96.         if (get_bits_count(&gb) > bit_len)

libavcodec/dvdsubdec.c:114:5: Loop condition is true. Entering loop body
112.             align_get_bits(&gb);
113.         }
114.     }
         ^
115.     return 0;
116. }

libavcodec/dvdsubdec.c:96:13: 
94.     d = bitmap;
95.     for(;;) {
96.         if (get_bits_count(&gb) > bit_len)
                ^
97.             return -1;
98.         if (is_8bit)

libavcodec/get_bits.h:207:1: start of procedure get_bits_count()
  205.         ((uint32_t)name##_cache)
  206. 
  207. static inline int get_bits_count(GetBitContext *s){
       ^
  208.     return s->index;
  209. }

libavcodec/get_bits.h:208:5: 
  206. 
  207. static inline int get_bits_count(GetBitContext *s){
  208.     return s->index;
           ^
  209. }
  210. 

libavcodec/get_bits.h:209:1: return from a call to get_bits_count
  207. static inline int get_bits_count(GetBitContext *s){
  208.     return s->index;
  209. }
       ^
  210. 
  211. static inline void skip_bits_long(GetBitContext *s, int n){

libavcodec/dvdsubdec.c:96:13: Taking false branch
94.     d = bitmap;
95.     for(;;) {
96.         if (get_bits_count(&gb) > bit_len)
                ^
97.             return -1;
98.         if (is_8bit)

libavcodec/dvdsubdec.c:98:13: Taking true branch
 96.         if (get_bits_count(&gb) > bit_len)
 97.             return -1;
 98.         if (is_8bit)
                 ^
 99.             len = decode_run_8bit(&gb, &color);
100.         else

libavcodec/dvdsubdec.c:99:13: 
 97.             return -1;
 98.         if (is_8bit)
 99.             len = decode_run_8bit(&gb, &color);
                 ^
100.         else
101.             len = decode_run_2bit(&gb, &color);

libavcodec/dvdsubdec.c:59:1: start of procedure decode_run_8bit()
  57. }
  58. 
  59. static int decode_run_8bit(GetBitContext *gb, int *color)
      ^
  60. {
  61.     int len;

libavcodec/dvdsubdec.c:62:5: 
  60. {
  61.     int len;
  62.     int has_run = get_bits1(gb);
          ^
  63.     if (get_bits1(gb))
  64.         *color = get_bits(gb, 8);

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:421:5: 
    419.     uint8_t result= s->buffer[ index>>3 ];
    420. #ifdef ALT_BITSTREAM_READER_LE
    421.     result>>= (index&0x07);
             ^
    422.     result&= 1;
    423. #else

libavcodec/get_bits.h:422:5: 
    420. #ifdef ALT_BITSTREAM_READER_LE
    421.     result>>= (index&0x07);
    422.     result&= 1;
             ^
    423. #else
    424.     result<<= (index&0x07);

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){

libavcodec/dvdsubdec.c:63:9: 
  61.     int len;
  62.     int has_run = get_bits1(gb);
  63.     if (get_bits1(gb))
              ^
  64.         *color = get_bits(gb, 8);
  65.     else

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:421:5: 
    419.     uint8_t result= s->buffer[ index>>3 ];
    420. #ifdef ALT_BITSTREAM_READER_LE
    421.     result>>= (index&0x07);
             ^
    422.     result&= 1;
    423. #else

libavcodec/get_bits.h:422:5: 
    420. #ifdef ALT_BITSTREAM_READER_LE
    421.     result>>= (index&0x07);
    422.     result&= 1;
             ^
    423. #else
    424.     result<<= (index&0x07);

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){

libavcodec/dvdsubdec.c:63:9: Taking false branch
  61.     int len;
  62.     int has_run = get_bits1(gb);
  63.     if (get_bits1(gb))
              ^
  64.         *color = get_bits(gb, 8);
  65.     else

libavcodec/dvdsubdec.c:66:9: 
  64.         *color = get_bits(gb, 8);
  65.     else
  66.         *color = get_bits(gb, 2);
              ^
  67.     if (has_run) {
  68.         if (get_bits1(gb)) {

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:54:1: start of procedure bswap_32()
      52. 
      53. #ifndef bswap_32
      54. static av_always_inline av_const uint32_t bswap_32(uint32_t x)
          ^
      55. {
      56.     x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);

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

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

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

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

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. /**

libavcodec/dvdsubdec.c:67:9: Taking true branch
  65.     else
  66.         *color = get_bits(gb, 2);
  67.     if (has_run) {
              ^
  68.         if (get_bits1(gb)) {
  69.             len = get_bits(gb, 7);

libavcodec/dvdsubdec.c:68:13: 
  66.         *color = get_bits(gb, 2);
  67.     if (has_run) {
  68.         if (get_bits1(gb)) {
                  ^
  69.             len = get_bits(gb, 7);
  70.             if (len == 0)

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);
