libavcodec/flashsvenc.c:148: error: Null Dereference
  pointer `&pb->buf_ptr` last assigned on line 143 could be null and is dereferenced by call to `put_bits()` at line 148, column 5.

libavcodec/flashsvenc.c:135:1: start of procedure encode_bitstream()
133. 
134. 
135. static int encode_bitstream(FlashSVContext *s, AVFrame *p, uint8_t *buf, int buf_size,
     ^
136.      int block_width, int block_height, uint8_t *previous_frame, int* I_frame) {
137. 

libavcodec/flashsvenc.c:141:5: 
139.     int h_blocks, v_blocks, h_part, v_part, i, j;
140.     int buf_pos, res;
141.     int pred_blocks = 0;
         ^
142. 
143.     init_put_bits(&pb, buf, buf_size*8);

libavcodec/flashsvenc.c:143:5: 
141.     int pred_blocks = 0;
142. 
143.     init_put_bits(&pb, buf, buf_size*8);
         ^
144. 
145.     put_bits(&pb, 4, (block_width/16)-1);

libavcodec/bitstream.h:90:1: start of procedure init_put_bits()
  88. } PutBitContext;
  89. 
  90. static inline void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size)
      ^
  91. {
  92.     if(buffer_size < 0) {

libavcodec/bitstream.h:92:8: Taking true branch
  90. static inline void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size)
  91. {
  92.     if(buffer_size < 0) {
             ^
  93.         buffer_size = 0;
  94.         buffer = NULL;

libavcodec/bitstream.h:93:9: 
  91. {
  92.     if(buffer_size < 0) {
  93.         buffer_size = 0;
              ^
  94.         buffer = NULL;
  95.     }

libavcodec/bitstream.h:94:9: 
  92.     if(buffer_size < 0) {
  93.         buffer_size = 0;
  94.         buffer = NULL;
              ^
  95.     }
  96. 

libavcodec/bitstream.h:97:5: 
  95.     }
  96. 
  97.     s->buf = buffer;
          ^
  98.     s->buf_end = s->buf + buffer_size;
  99. #ifdef ALT_BITSTREAM_WRITER

libavcodec/bitstream.h:98:5: 
   96. 
   97.     s->buf = buffer;
   98.     s->buf_end = s->buf + buffer_size;
           ^
   99. #ifdef ALT_BITSTREAM_WRITER
  100.     s->index=0;

libavcodec/bitstream.h:104:5: 
  102. //    memset(buffer, 0, buffer_size);
  103. #else
  104.     s->buf_ptr = s->buf;
           ^
  105.     s->bit_left=32;
  106.     s->bit_buf=0;

libavcodec/bitstream.h:105:5: 
  103. #else
  104.     s->buf_ptr = s->buf;
  105.     s->bit_left=32;
           ^
  106.     s->bit_buf=0;
  107. #endif

libavcodec/bitstream.h:106:5: 
  104.     s->buf_ptr = s->buf;
  105.     s->bit_left=32;
  106.     s->bit_buf=0;
           ^
  107. #endif
  108. }

libavcodec/bitstream.h:108:1: return from a call to init_put_bits
  106.     s->bit_buf=0;
  107. #endif
  108. }
       ^
  109. 
  110. /* return the number of bits output */

libavcodec/flashsvenc.c:145:5: 
143.     init_put_bits(&pb, buf, buf_size*8);
144. 
145.     put_bits(&pb, 4, (block_width/16)-1);
         ^
146.     put_bits(&pb, 12, s->image_width);
147.     put_bits(&pb, 4, (block_height/16)-1);

libavcodec/bitstream.h:187:1: start of procedure put_bits()
  185. 
  186. #ifndef ALT_BITSTREAM_WRITER
  187. static inline void put_bits(PutBitContext *s, int n, unsigned int value)
       ^
  188. {
  189.     unsigned int bit_buf;

libavcodec/bitstream.h:193:5: 
  191. 
  192.     //    printf("put_bits=%d %x\n", n, value);
  193.     assert(n == 32 || value < (1U << n));
           ^
  194. 
  195.     bit_buf = s->bit_buf;

libavcodec/bitstream.h:195:5: 
  193.     assert(n == 32 || value < (1U << n));
  194. 
  195.     bit_buf = s->bit_buf;
           ^
  196.     bit_left = s->bit_left;
  197. 

libavcodec/bitstream.h:196:5: 
  194. 
  195.     bit_buf = s->bit_buf;
  196.     bit_left = s->bit_left;
           ^
  197. 
  198.     //    printf("n=%d value=%x cnt=%d buf=%x\n", n, value, bit_cnt, bit_buf);

libavcodec/bitstream.h:218:9: Taking true branch
  216.     bit_left-=n;
  217. #else
  218.     if (n < bit_left) {
               ^
  219.         bit_buf = (bit_buf<<n) | value;
  220.         bit_left-=n;

libavcodec/bitstream.h:219:9: 
  217. #else
  218.     if (n < bit_left) {
  219.         bit_buf = (bit_buf<<n) | value;
               ^
  220.         bit_left-=n;
  221.     } else {

libavcodec/bitstream.h:220:9: 
  218.     if (n < bit_left) {
  219.         bit_buf = (bit_buf<<n) | value;
  220.         bit_left-=n;
               ^
  221.     } else {
  222.         bit_buf<<=bit_left;

libavcodec/bitstream.h:240:5: 
  238. #endif
  239. 
  240.     s->bit_buf = bit_buf;
           ^
  241.     s->bit_left = bit_left;
  242. }

libavcodec/bitstream.h:241:5: 
  239. 
  240.     s->bit_buf = bit_buf;
  241.     s->bit_left = bit_left;
           ^
  242. }
  243. #endif

libavcodec/bitstream.h:242:1: return from a call to put_bits
  240.     s->bit_buf = bit_buf;
  241.     s->bit_left = bit_left;
  242. }
       ^
  243. #endif
  244. 

libavcodec/flashsvenc.c:146:5: 
144. 
145.     put_bits(&pb, 4, (block_width/16)-1);
146.     put_bits(&pb, 12, s->image_width);
         ^
147.     put_bits(&pb, 4, (block_height/16)-1);
148.     put_bits(&pb, 12, s->image_height);

libavcodec/bitstream.h:187:1: start of procedure put_bits()
  185. 
  186. #ifndef ALT_BITSTREAM_WRITER
  187. static inline void put_bits(PutBitContext *s, int n, unsigned int value)
       ^
  188. {
  189.     unsigned int bit_buf;

libavcodec/bitstream.h:193:5: 
  191. 
  192.     //    printf("put_bits=%d %x\n", n, value);
  193.     assert(n == 32 || value < (1U << n));
           ^
  194. 
  195.     bit_buf = s->bit_buf;

libavcodec/bitstream.h:195:5: 
  193.     assert(n == 32 || value < (1U << n));
  194. 
  195.     bit_buf = s->bit_buf;
           ^
  196.     bit_left = s->bit_left;
  197. 

libavcodec/bitstream.h:196:5: 
  194. 
  195.     bit_buf = s->bit_buf;
  196.     bit_left = s->bit_left;
           ^
  197. 
  198.     //    printf("n=%d value=%x cnt=%d buf=%x\n", n, value, bit_cnt, bit_buf);

libavcodec/bitstream.h:218:9: Taking true branch
  216.     bit_left-=n;
  217. #else
  218.     if (n < bit_left) {
               ^
  219.         bit_buf = (bit_buf<<n) | value;
  220.         bit_left-=n;

libavcodec/bitstream.h:219:9: 
  217. #else
  218.     if (n < bit_left) {
  219.         bit_buf = (bit_buf<<n) | value;
               ^
  220.         bit_left-=n;
  221.     } else {

libavcodec/bitstream.h:220:9: 
  218.     if (n < bit_left) {
  219.         bit_buf = (bit_buf<<n) | value;
  220.         bit_left-=n;
               ^
  221.     } else {
  222.         bit_buf<<=bit_left;

libavcodec/bitstream.h:240:5: 
  238. #endif
  239. 
  240.     s->bit_buf = bit_buf;
           ^
  241.     s->bit_left = bit_left;
  242. }

libavcodec/bitstream.h:241:5: 
  239. 
  240.     s->bit_buf = bit_buf;
  241.     s->bit_left = bit_left;
           ^
  242. }
  243. #endif

libavcodec/bitstream.h:242:1: return from a call to put_bits
  240.     s->bit_buf = bit_buf;
  241.     s->bit_left = bit_left;
  242. }
       ^
  243. #endif
  244. 

libavcodec/flashsvenc.c:147:5: 
145.     put_bits(&pb, 4, (block_width/16)-1);
146.     put_bits(&pb, 12, s->image_width);
147.     put_bits(&pb, 4, (block_height/16)-1);
         ^
148.     put_bits(&pb, 12, s->image_height);
149.     flush_put_bits(&pb);

libavcodec/bitstream.h:187:1: start of procedure put_bits()
  185. 
  186. #ifndef ALT_BITSTREAM_WRITER
  187. static inline void put_bits(PutBitContext *s, int n, unsigned int value)
       ^
  188. {
  189.     unsigned int bit_buf;

libavcodec/bitstream.h:193:5: 
  191. 
  192.     //    printf("put_bits=%d %x\n", n, value);
  193.     assert(n == 32 || value < (1U << n));
           ^
  194. 
  195.     bit_buf = s->bit_buf;

libavcodec/bitstream.h:195:5: 
  193.     assert(n == 32 || value < (1U << n));
  194. 
  195.     bit_buf = s->bit_buf;
           ^
  196.     bit_left = s->bit_left;
  197. 

libavcodec/bitstream.h:196:5: 
  194. 
  195.     bit_buf = s->bit_buf;
  196.     bit_left = s->bit_left;
           ^
  197. 
  198.     //    printf("n=%d value=%x cnt=%d buf=%x\n", n, value, bit_cnt, bit_buf);

libavcodec/bitstream.h:218:9: Taking true branch
  216.     bit_left-=n;
  217. #else
  218.     if (n < bit_left) {
               ^
  219.         bit_buf = (bit_buf<<n) | value;
  220.         bit_left-=n;

libavcodec/bitstream.h:219:9: 
  217. #else
  218.     if (n < bit_left) {
  219.         bit_buf = (bit_buf<<n) | value;
               ^
  220.         bit_left-=n;
  221.     } else {

libavcodec/bitstream.h:220:9: 
  218.     if (n < bit_left) {
  219.         bit_buf = (bit_buf<<n) | value;
  220.         bit_left-=n;
               ^
  221.     } else {
  222.         bit_buf<<=bit_left;

libavcodec/bitstream.h:240:5: 
  238. #endif
  239. 
  240.     s->bit_buf = bit_buf;
           ^
  241.     s->bit_left = bit_left;
  242. }

libavcodec/bitstream.h:241:5: 
  239. 
  240.     s->bit_buf = bit_buf;
  241.     s->bit_left = bit_left;
           ^
  242. }
  243. #endif

libavcodec/bitstream.h:242:1: return from a call to put_bits
  240.     s->bit_buf = bit_buf;
  241.     s->bit_left = bit_left;
  242. }
       ^
  243. #endif
  244. 

libavcodec/flashsvenc.c:148:5: 
146.     put_bits(&pb, 12, s->image_width);
147.     put_bits(&pb, 4, (block_height/16)-1);
148.     put_bits(&pb, 12, s->image_height);
         ^
149.     flush_put_bits(&pb);
150.     buf_pos=4;

libavcodec/bitstream.h:187:1: start of procedure put_bits()
  185. 
  186. #ifndef ALT_BITSTREAM_WRITER
  187. static inline void put_bits(PutBitContext *s, int n, unsigned int value)
       ^
  188. {
  189.     unsigned int bit_buf;

libavcodec/bitstream.h:193:5: 
  191. 
  192.     //    printf("put_bits=%d %x\n", n, value);
  193.     assert(n == 32 || value < (1U << n));
           ^
  194. 
  195.     bit_buf = s->bit_buf;

libavcodec/bitstream.h:195:5: 
  193.     assert(n == 32 || value < (1U << n));
  194. 
  195.     bit_buf = s->bit_buf;
           ^
  196.     bit_left = s->bit_left;
  197. 

libavcodec/bitstream.h:196:5: 
  194. 
  195.     bit_buf = s->bit_buf;
  196.     bit_left = s->bit_left;
           ^
  197. 
  198.     //    printf("n=%d value=%x cnt=%d buf=%x\n", n, value, bit_cnt, bit_buf);

libavcodec/bitstream.h:218:9: Taking false branch
  216.     bit_left-=n;
  217. #else
  218.     if (n < bit_left) {
               ^
  219.         bit_buf = (bit_buf<<n) | value;
  220.         bit_left-=n;

libavcodec/bitstream.h:222:9: 
  220.         bit_left-=n;
  221.     } else {
  222.         bit_buf<<=bit_left;
               ^
  223.         bit_buf |= value >> (n - bit_left);
  224. #ifdef UNALIGNED_STORES_ARE_BAD

libavcodec/bitstream.h:223:9: 
  221.     } else {
  222.         bit_buf<<=bit_left;
  223.         bit_buf |= value >> (n - bit_left);
               ^
  224. #ifdef UNALIGNED_STORES_ARE_BAD
  225.         if (3 & (intptr_t) s->buf_ptr) {

libavcodec/bitstream.h:232:35: 
  230.         } else
  231. #endif
  232.         *(uint32_t *)s->buf_ptr = be2me_32(bit_buf);
                                         ^
  233.         //printf("bitbuf = %08x\n", bit_buf);
  234.         s->buf_ptr+=4;

libavcodec/bitstream.h:232:9: 
  230.         } else
  231. #endif
  232.         *(uint32_t *)s->buf_ptr = be2me_32(bit_buf);
               ^
  233.         //printf("bitbuf = %08x\n", bit_buf);
  234.         s->buf_ptr+=4;
