libavcodec/mlpdec.c:1003: error: Null Dereference
  pointer `&gb->buffer` last assigned on line 981 could be null and is dereferenced by call to `get_bits1()` at line 1003, column 29.

libavcodec/mlpdec.c:957:1: start of procedure read_access_unit()
955.  *  otherwise the number of bytes consumed. */
956. 
957. static int read_access_unit(AVCodecContext *avctx, void* data,
     ^
958.                             int *got_frame_ptr, AVPacket *avpkt)
959. {

libavcodec/mlpdec.c:960:5: 
958.                             int *got_frame_ptr, AVPacket *avpkt)
959. {
960.     const uint8_t *buf = avpkt->data;
         ^
961.     int buf_size = avpkt->size;
962.     MLPDecodeContext *m = avctx->priv_data;

libavcodec/mlpdec.c:961:5: 
959. {
960.     const uint8_t *buf = avpkt->data;
961.     int buf_size = avpkt->size;
         ^
962.     MLPDecodeContext *m = avctx->priv_data;
963.     GetBitContext gb;

libavcodec/mlpdec.c:962:5: 
960.     const uint8_t *buf = avpkt->data;
961.     int buf_size = avpkt->size;
962.     MLPDecodeContext *m = avctx->priv_data;
         ^
963.     GetBitContext gb;
964.     unsigned int length, substr;

libavcodec/mlpdec.c:966:5: 
964.     unsigned int length, substr;
965.     unsigned int substream_start;
966.     unsigned int header_size = 4;
         ^
967.     unsigned int substr_header_size = 0;
968.     uint8_t substream_parity_present[MAX_SUBSTREAMS];

libavcodec/mlpdec.c:967:5: 
965.     unsigned int substream_start;
966.     unsigned int header_size = 4;
967.     unsigned int substr_header_size = 0;
         ^
968.     uint8_t substream_parity_present[MAX_SUBSTREAMS];
969.     uint16_t substream_data_len[MAX_SUBSTREAMS];

libavcodec/mlpdec.c:973:9: Taking false branch
971.     int ret;
972. 
973.     if (buf_size < 4)
             ^
974.         return 0;
975. 

libavcodec/mlpdec.c:976:5: 
974.         return 0;
975. 
976.     length = (AV_RB16(buf) & 0xfff) * 2;
         ^
977. 
978.     if (length < 4 || length > buf_size)

libavutil/bswap.h:58:1: start of procedure av_bswap16()
  56. 
  57. #ifndef av_bswap16
  58. static av_always_inline av_const uint16_t av_bswap16(uint16_t x)
      ^
  59. {
  60.     x= (x>>8) | (x<<8);

libavutil/bswap.h:60:5: 
  58. static av_always_inline av_const uint16_t av_bswap16(uint16_t x)
  59. {
  60.     x= (x>>8) | (x<<8);
          ^
  61.     return x;
  62. }

libavutil/bswap.h:61:5: 
  59. {
  60.     x= (x>>8) | (x<<8);
  61.     return x;
          ^
  62. }
  63. #endif

libavutil/bswap.h:62:1: return from a call to av_bswap16
  60.     x= (x>>8) | (x<<8);
  61.     return x;
  62. }
      ^
  63. #endif
  64. 

libavcodec/mlpdec.c:978:9: Taking false branch
976.     length = (AV_RB16(buf) & 0xfff) * 2;
977. 
978.     if (length < 4 || length > buf_size)
             ^
979.         return AVERROR_INVALIDDATA;
980. 

libavcodec/mlpdec.c:978:23: Taking false branch
976.     length = (AV_RB16(buf) & 0xfff) * 2;
977. 
978.     if (length < 4 || length > buf_size)
                           ^
979.         return AVERROR_INVALIDDATA;
980. 

libavcodec/mlpdec.c:981:5: 
979.         return AVERROR_INVALIDDATA;
980. 
981.     init_get_bits(&gb, (buf + 4), (length - 4) * 8);
         ^
982. 
983.     m->is_major_sync_unit = 0;

libavcodec/get_bits.h:306:1: start of procedure init_get_bits()
  304.  * responsible for checking for the buffer end yourself (take advantage of the padding)!
  305.  */
  306. static inline void init_get_bits(GetBitContext *s,
       ^
  307.                    const uint8_t *buffer, int bit_size)
  308. {

libavcodec/get_bits.h:309:5: 
  307.                    const uint8_t *buffer, int bit_size)
  308. {
  309.     int buffer_size = (bit_size+7)>>3;
           ^
  310.     if (buffer_size < 0 || bit_size < 0) {
  311.         buffer_size = bit_size = 0;

libavcodec/get_bits.h:310:9: Taking true branch
  308. {
  309.     int buffer_size = (bit_size+7)>>3;
  310.     if (buffer_size < 0 || bit_size < 0) {
               ^
  311.         buffer_size = bit_size = 0;
  312.         buffer = NULL;

libavcodec/get_bits.h:311:9: 
  309.     int buffer_size = (bit_size+7)>>3;
  310.     if (buffer_size < 0 || bit_size < 0) {
  311.         buffer_size = bit_size = 0;
               ^
  312.         buffer = NULL;
  313.     }

libavcodec/get_bits.h:312:9: 
  310.     if (buffer_size < 0 || bit_size < 0) {
  311.         buffer_size = bit_size = 0;
  312.         buffer = NULL;
               ^
  313.     }
  314. 

libavcodec/get_bits.h:315:5: 
  313.     }
  314. 
  315.     s->buffer       = buffer;
           ^
  316.     s->size_in_bits = bit_size;
  317.     s->buffer_end   = buffer + buffer_size;

libavcodec/get_bits.h:316:5: 
  314. 
  315.     s->buffer       = buffer;
  316.     s->size_in_bits = bit_size;
           ^
  317.     s->buffer_end   = buffer + buffer_size;
  318.     s->index        = 0;

libavcodec/get_bits.h:317:5: 
  315.     s->buffer       = buffer;
  316.     s->size_in_bits = bit_size;
  317.     s->buffer_end   = buffer + buffer_size;
           ^
  318.     s->index        = 0;
  319. }

libavcodec/get_bits.h:318:5: 
  316.     s->size_in_bits = bit_size;
  317.     s->buffer_end   = buffer + buffer_size;
  318.     s->index        = 0;
           ^
  319. }
  320. 

libavcodec/get_bits.h:319:1: return from a call to init_get_bits
  317.     s->buffer_end   = buffer + buffer_size;
  318.     s->index        = 0;
  319. }
       ^
  320. 
  321. static inline void align_get_bits(GetBitContext *s)

libavcodec/mlpdec.c:983:5: 
981.     init_get_bits(&gb, (buf + 4), (length - 4) * 8);
982. 
983.     m->is_major_sync_unit = 0;
         ^
984.     if (show_bits_long(&gb, 31) == (0xf8726fba >> 1)) {
985.         if (read_major_sync(m, &gb) < 0)

libavcodec/mlpdec.c:984:9: 
982. 
983.     m->is_major_sync_unit = 0;
984.     if (show_bits_long(&gb, 31) == (0xf8726fba >> 1)) {
             ^
985.         if (read_major_sync(m, &gb) < 0)
986.             goto error;

libavcodec/get_bits.h:280:1: start of procedure show_bits_long()
  278.  * Show 0-32 bits.
  279.  */
  280. static inline unsigned int show_bits_long(GetBitContext *s, int n){
       ^
  281.     if (n <= MIN_CACHE_BITS) return show_bits(s, n);
  282.     else {

libavcodec/get_bits.h:281:9: Taking false branch
  279.  */
  280. static inline unsigned int show_bits_long(GetBitContext *s, int n){
  281.     if (n <= MIN_CACHE_BITS) return show_bits(s, n);
               ^
  282.     else {
  283.         GetBitContext gb = *s;

libavcodec/get_bits.h:283:9: 
  281.     if (n <= MIN_CACHE_BITS) return show_bits(s, n);
  282.     else {
  283.         GetBitContext gb = *s;
               ^
  284.         return get_bits_long(&gb, n);
  285.     }

libavcodec/get_bits.h:284:9: 
  282.     else {
  283.         GetBitContext gb = *s;
  284.         return get_bits_long(&gb, n);
               ^
  285.     }
  286. }

libavcodec/get_bits.h:257:1: start of procedure get_bits_long()
    255.  * Read 0-32 bits.
    256.  */
    257. static inline unsigned int get_bits_long(GetBitContext *s, int n){
         ^
    258.     if (n <= MIN_CACHE_BITS) return get_bits(s, n);
    259.     else {

libavcodec/get_bits.h:258:9: Taking false branch
    256.  */
    257. static inline unsigned int get_bits_long(GetBitContext *s, int n){
    258.     if (n <= MIN_CACHE_BITS) return get_bits(s, n);
                 ^
    259.     else {
    260. #ifdef ALT_BITSTREAM_READER_LE

libavcodec/get_bits.h:264:9: 
    262.         return ret | (get_bits(s, n-16) << 16);
    263. #else
    264.         int ret = get_bits(s, 16) << (n-16);
                 ^
    265.         return ret | get_bits(s, n-16);
    266. #endif

libavcodec/get_bits.h:201:1: start of procedure get_bits()
      199.  * Read 1-25 bits.
      200.  */
      201. static inline unsigned int get_bits(GetBitContext *s, int n){
           ^
      202.     register int tmp;
      203.     OPEN_READER(re, s);

libavcodec/get_bits.h:203:5: 
      201. static inline unsigned int get_bits(GetBitContext *s, int n){
      202.     register int tmp;
      203.     OPEN_READER(re, s);
               ^
      204.     UPDATE_CACHE(re, s);
      205.     tmp = SHOW_UBITS(re, s, n);

libavcodec/get_bits.h:204:5: 
      202.     register int tmp;
      203.     OPEN_READER(re, s);
      204.     UPDATE_CACHE(re, s);
               ^
      205.     tmp = SHOW_UBITS(re, s, n);
      206.     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.     return AV_BSWAP32C(x);

libavutil/bswap.h:68:5: 
        66. static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
        67. {
        68.     return AV_BSWAP32C(x);
                ^
        69. }
        70. #endif

libavutil/bswap.h:69:1: return from a call to av_bswap32
        67. {
        68.     return AV_BSWAP32C(x);
        69. }
            ^
        70. #endif
        71. 

libavcodec/get_bits.h:205:5: 
      203.     OPEN_READER(re, s);
      204.     UPDATE_CACHE(re, s);
      205.     tmp = SHOW_UBITS(re, s, n);
               ^
      206.     LAST_SKIP_BITS(re, s, n);
      207.     CLOSE_READER(re, s);

libavcodec/get_bits.h:206:5: 
      204.     UPDATE_CACHE(re, s);
      205.     tmp = SHOW_UBITS(re, s, n);
      206.     LAST_SKIP_BITS(re, s, n);
               ^
      207.     CLOSE_READER(re, s);
      208.     return tmp;

libavcodec/get_bits.h:207:5: 
      205.     tmp = SHOW_UBITS(re, s, n);
      206.     LAST_SKIP_BITS(re, s, n);
      207.     CLOSE_READER(re, s);
               ^
      208.     return tmp;
      209. }

libavcodec/get_bits.h:208:5: 
      206.     LAST_SKIP_BITS(re, s, n);
      207.     CLOSE_READER(re, s);
      208.     return tmp;
               ^
      209. }
      210. 

libavcodec/get_bits.h:209:1: return from a call to get_bits
      207.     CLOSE_READER(re, s);
      208.     return tmp;
      209. }
           ^
      210. 
      211. /**

libavcodec/get_bits.h:265:9: 
    263. #else
    264.         int ret = get_bits(s, 16) << (n-16);
    265.         return ret | get_bits(s, n-16);
                 ^
    266. #endif
    267.     }

libavcodec/get_bits.h:201:1: start of procedure get_bits()
      199.  * Read 1-25 bits.
      200.  */
      201. static inline unsigned int get_bits(GetBitContext *s, int n){
           ^
      202.     register int tmp;
      203.     OPEN_READER(re, s);

libavcodec/get_bits.h:203:5: 
      201. static inline unsigned int get_bits(GetBitContext *s, int n){
      202.     register int tmp;
      203.     OPEN_READER(re, s);
               ^
      204.     UPDATE_CACHE(re, s);
      205.     tmp = SHOW_UBITS(re, s, n);

libavcodec/get_bits.h:204:5: 
      202.     register int tmp;
      203.     OPEN_READER(re, s);
      204.     UPDATE_CACHE(re, s);
               ^
      205.     tmp = SHOW_UBITS(re, s, n);
      206.     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.     return AV_BSWAP32C(x);

libavutil/bswap.h:68:5: 
        66. static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
        67. {
        68.     return AV_BSWAP32C(x);
                ^
        69. }
        70. #endif

libavutil/bswap.h:69:1: return from a call to av_bswap32
        67. {
        68.     return AV_BSWAP32C(x);
        69. }
            ^
        70. #endif
        71. 

libavcodec/get_bits.h:205:5: 
      203.     OPEN_READER(re, s);
      204.     UPDATE_CACHE(re, s);
      205.     tmp = SHOW_UBITS(re, s, n);
               ^
      206.     LAST_SKIP_BITS(re, s, n);
      207.     CLOSE_READER(re, s);

libavcodec/get_bits.h:206:5: 
      204.     UPDATE_CACHE(re, s);
      205.     tmp = SHOW_UBITS(re, s, n);
      206.     LAST_SKIP_BITS(re, s, n);
               ^
      207.     CLOSE_READER(re, s);
      208.     return tmp;

libavcodec/get_bits.h:207:5: 
      205.     tmp = SHOW_UBITS(re, s, n);
      206.     LAST_SKIP_BITS(re, s, n);
      207.     CLOSE_READER(re, s);
               ^
      208.     return tmp;
      209. }

libavcodec/get_bits.h:208:5: 
      206.     LAST_SKIP_BITS(re, s, n);
      207.     CLOSE_READER(re, s);
      208.     return tmp;
               ^
      209. }
      210. 

libavcodec/get_bits.h:209:1: return from a call to get_bits
      207.     CLOSE_READER(re, s);
      208.     return tmp;
      209. }
           ^
      210. 
      211. /**

libavcodec/get_bits.h:268:1: return from a call to get_bits_long
    266. #endif
    267.     }
    268. }
         ^
    269. 
    270. /**

libavcodec/get_bits.h:286:1: return from a call to show_bits_long
  284.         return get_bits_long(&gb, n);
  285.     }
  286. }
       ^
  287. 
  288. static inline int check_marker(GetBitContext *s, const char *msg)

libavcodec/mlpdec.c:984:9: Taking false branch
982. 
983.     m->is_major_sync_unit = 0;
984.     if (show_bits_long(&gb, 31) == (0xf8726fba >> 1)) {
             ^
985.         if (read_major_sync(m, &gb) < 0)
986.             goto error;

libavcodec/mlpdec.c:991:10: Taking false branch
989.     }
990. 
991.     if (!m->params_valid) {
              ^
992.         av_log(m->avctx, AV_LOG_WARNING,
993.                "Stream parameters not seen; skipping frame.\n");

libavcodec/mlpdec.c:998:5: 
 996.     }
 997. 
 998.     substream_start = 0;
          ^
 999. 
1000.     for (substr = 0; substr < m->num_substreams; substr++) {

libavcodec/mlpdec.c:1000:10: 
 998.     substream_start = 0;
 999. 
1000.     for (substr = 0; substr < m->num_substreams; substr++) {
               ^
1001.         int extraword_present, checkdata_present, end, nonrestart_substr;
1002. 

libavcodec/mlpdec.c:1000:22: Loop condition is true. Entering loop body
 998.     substream_start = 0;
 999. 
1000.     for (substr = 0; substr < m->num_substreams; substr++) {
                           ^
1001.         int extraword_present, checkdata_present, end, nonrestart_substr;
1002. 

libavcodec/mlpdec.c:1003:9: 
1001.         int extraword_present, checkdata_present, end, nonrestart_substr;
1002. 
1003.         extraword_present = get_bits1(&gb);
              ^
1004.         nonrestart_substr = get_bits1(&gb);
1005.         checkdata_present = get_bits1(&gb);

libavcodec/get_bits.h:230:1: start of procedure get_bits1()
  228. }
  229. 
  230. static inline unsigned int get_bits1(GetBitContext *s){
       ^
  231.     unsigned int index = s->index;
  232.     uint8_t result = s->buffer[index>>3];

libavcodec/get_bits.h:231:5: 
  229. 
  230. static inline unsigned int get_bits1(GetBitContext *s){
  231.     unsigned int index = s->index;
           ^
  232.     uint8_t result = s->buffer[index>>3];
  233. #ifdef ALT_BITSTREAM_READER_LE

libavcodec/get_bits.h:232:5: 
  230. static inline unsigned int get_bits1(GetBitContext *s){
  231.     unsigned int index = s->index;
  232.     uint8_t result = s->buffer[index>>3];
           ^
  233. #ifdef ALT_BITSTREAM_READER_LE
  234.     result >>= index & 7;
