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:91:1: start of procedure init_put_bits()
  89. } PutBitContext;
  90. 
  91. static inline void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size)
      ^
  92. {
  93.     if(buffer_size < 0) {

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

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

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

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

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

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

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

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

libavcodec/bitstream.h:109:1: return from a call to init_put_bits
  107.     s->bit_buf=0;
  108. #endif
  109. }
       ^
  110. 
  111. /* 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:213:1: start of procedure put_bits()
  211. 
  212. #ifndef ALT_BITSTREAM_WRITER
  213. static inline void put_bits(PutBitContext *s, int n, unsigned int value)
       ^
  214. {
  215.     unsigned int bit_buf;

libavcodec/bitstream.h:219:5: 
  217. 
  218.     //    printf("put_bits=%d %x\n", n, value);
  219.     assert(n == 32 || value < (1U << n));
           ^
  220. 
  221.     bit_buf = s->bit_buf;

libavcodec/bitstream.h:221:5: 
  219.     assert(n == 32 || value < (1U << n));
  220. 
  221.     bit_buf = s->bit_buf;
           ^
  222.     bit_left = s->bit_left;
  223. 

libavcodec/bitstream.h:222:5: 
  220. 
  221.     bit_buf = s->bit_buf;
  222.     bit_left = s->bit_left;
           ^
  223. 
  224.     //    printf("n=%d value=%x cnt=%d buf=%x\n", n, value, bit_cnt, bit_buf);

libavcodec/bitstream.h:226:9: Taking true branch
  224.     //    printf("n=%d value=%x cnt=%d buf=%x\n", n, value, bit_cnt, bit_buf);
  225.     /* XXX: optimize */
  226.     if (n < bit_left) {
               ^
  227.         bit_buf = (bit_buf<<n) | value;
  228.         bit_left-=n;

libavcodec/bitstream.h:227:9: 
  225.     /* XXX: optimize */
  226.     if (n < bit_left) {
  227.         bit_buf = (bit_buf<<n) | value;
               ^
  228.         bit_left-=n;
  229.     } else {

libavcodec/bitstream.h:228:9: 
  226.     if (n < bit_left) {
  227.         bit_buf = (bit_buf<<n) | value;
  228.         bit_left-=n;
               ^
  229.     } else {
  230.         bit_buf<<=bit_left;

libavcodec/bitstream.h:247:5: 
  245.     }
  246. 
  247.     s->bit_buf = bit_buf;
           ^
  248.     s->bit_left = bit_left;
  249. }

libavcodec/bitstream.h:248:5: 
  246. 
  247.     s->bit_buf = bit_buf;
  248.     s->bit_left = bit_left;
           ^
  249. }
  250. #endif

libavcodec/bitstream.h:249:1: return from a call to put_bits
  247.     s->bit_buf = bit_buf;
  248.     s->bit_left = bit_left;
  249. }
       ^
  250. #endif
  251. 

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:213:1: start of procedure put_bits()
  211. 
  212. #ifndef ALT_BITSTREAM_WRITER
  213. static inline void put_bits(PutBitContext *s, int n, unsigned int value)
       ^
  214. {
  215.     unsigned int bit_buf;

libavcodec/bitstream.h:219:5: 
  217. 
  218.     //    printf("put_bits=%d %x\n", n, value);
  219.     assert(n == 32 || value < (1U << n));
           ^
  220. 
  221.     bit_buf = s->bit_buf;

libavcodec/bitstream.h:221:5: 
  219.     assert(n == 32 || value < (1U << n));
  220. 
  221.     bit_buf = s->bit_buf;
           ^
  222.     bit_left = s->bit_left;
  223. 

libavcodec/bitstream.h:222:5: 
  220. 
  221.     bit_buf = s->bit_buf;
  222.     bit_left = s->bit_left;
           ^
  223. 
  224.     //    printf("n=%d value=%x cnt=%d buf=%x\n", n, value, bit_cnt, bit_buf);

libavcodec/bitstream.h:226:9: Taking true branch
  224.     //    printf("n=%d value=%x cnt=%d buf=%x\n", n, value, bit_cnt, bit_buf);
  225.     /* XXX: optimize */
  226.     if (n < bit_left) {
               ^
  227.         bit_buf = (bit_buf<<n) | value;
  228.         bit_left-=n;

libavcodec/bitstream.h:227:9: 
  225.     /* XXX: optimize */
  226.     if (n < bit_left) {
  227.         bit_buf = (bit_buf<<n) | value;
               ^
  228.         bit_left-=n;
  229.     } else {

libavcodec/bitstream.h:228:9: 
  226.     if (n < bit_left) {
  227.         bit_buf = (bit_buf<<n) | value;
  228.         bit_left-=n;
               ^
  229.     } else {
  230.         bit_buf<<=bit_left;

libavcodec/bitstream.h:247:5: 
  245.     }
  246. 
  247.     s->bit_buf = bit_buf;
           ^
  248.     s->bit_left = bit_left;
  249. }

libavcodec/bitstream.h:248:5: 
  246. 
  247.     s->bit_buf = bit_buf;
  248.     s->bit_left = bit_left;
           ^
  249. }
  250. #endif

libavcodec/bitstream.h:249:1: return from a call to put_bits
  247.     s->bit_buf = bit_buf;
  248.     s->bit_left = bit_left;
  249. }
       ^
  250. #endif
  251. 

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:213:1: start of procedure put_bits()
  211. 
  212. #ifndef ALT_BITSTREAM_WRITER
  213. static inline void put_bits(PutBitContext *s, int n, unsigned int value)
       ^
  214. {
  215.     unsigned int bit_buf;

libavcodec/bitstream.h:219:5: 
  217. 
  218.     //    printf("put_bits=%d %x\n", n, value);
  219.     assert(n == 32 || value < (1U << n));
           ^
  220. 
  221.     bit_buf = s->bit_buf;

libavcodec/bitstream.h:221:5: 
  219.     assert(n == 32 || value < (1U << n));
  220. 
  221.     bit_buf = s->bit_buf;
           ^
  222.     bit_left = s->bit_left;
  223. 

libavcodec/bitstream.h:222:5: 
  220. 
  221.     bit_buf = s->bit_buf;
  222.     bit_left = s->bit_left;
           ^
  223. 
  224.     //    printf("n=%d value=%x cnt=%d buf=%x\n", n, value, bit_cnt, bit_buf);

libavcodec/bitstream.h:226:9: Taking true branch
  224.     //    printf("n=%d value=%x cnt=%d buf=%x\n", n, value, bit_cnt, bit_buf);
  225.     /* XXX: optimize */
  226.     if (n < bit_left) {
               ^
  227.         bit_buf = (bit_buf<<n) | value;
  228.         bit_left-=n;

libavcodec/bitstream.h:227:9: 
  225.     /* XXX: optimize */
  226.     if (n < bit_left) {
  227.         bit_buf = (bit_buf<<n) | value;
               ^
  228.         bit_left-=n;
  229.     } else {

libavcodec/bitstream.h:228:9: 
  226.     if (n < bit_left) {
  227.         bit_buf = (bit_buf<<n) | value;
  228.         bit_left-=n;
               ^
  229.     } else {
  230.         bit_buf<<=bit_left;

libavcodec/bitstream.h:247:5: 
  245.     }
  246. 
  247.     s->bit_buf = bit_buf;
           ^
  248.     s->bit_left = bit_left;
  249. }

libavcodec/bitstream.h:248:5: 
  246. 
  247.     s->bit_buf = bit_buf;
  248.     s->bit_left = bit_left;
           ^
  249. }
  250. #endif

libavcodec/bitstream.h:249:1: return from a call to put_bits
  247.     s->bit_buf = bit_buf;
  248.     s->bit_left = bit_left;
  249. }
       ^
  250. #endif
  251. 

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:213:1: start of procedure put_bits()
  211. 
  212. #ifndef ALT_BITSTREAM_WRITER
  213. static inline void put_bits(PutBitContext *s, int n, unsigned int value)
       ^
  214. {
  215.     unsigned int bit_buf;

libavcodec/bitstream.h:219:5: 
  217. 
  218.     //    printf("put_bits=%d %x\n", n, value);
  219.     assert(n == 32 || value < (1U << n));
           ^
  220. 
  221.     bit_buf = s->bit_buf;

libavcodec/bitstream.h:221:5: 
  219.     assert(n == 32 || value < (1U << n));
  220. 
  221.     bit_buf = s->bit_buf;
           ^
  222.     bit_left = s->bit_left;
  223. 

libavcodec/bitstream.h:222:5: 
  220. 
  221.     bit_buf = s->bit_buf;
  222.     bit_left = s->bit_left;
           ^
  223. 
  224.     //    printf("n=%d value=%x cnt=%d buf=%x\n", n, value, bit_cnt, bit_buf);

libavcodec/bitstream.h:226:9: Taking false branch
  224.     //    printf("n=%d value=%x cnt=%d buf=%x\n", n, value, bit_cnt, bit_buf);
  225.     /* XXX: optimize */
  226.     if (n < bit_left) {
               ^
  227.         bit_buf = (bit_buf<<n) | value;
  228.         bit_left-=n;

libavcodec/bitstream.h:230:9: 
  228.         bit_left-=n;
  229.     } else {
  230.         bit_buf<<=bit_left;
               ^
  231.         bit_buf |= value >> (n - bit_left);
  232. #ifdef UNALIGNED_STORES_ARE_BAD

libavcodec/bitstream.h:231:9: 
  229.     } else {
  230.         bit_buf<<=bit_left;
  231.         bit_buf |= value >> (n - bit_left);
               ^
  232. #ifdef UNALIGNED_STORES_ARE_BAD
  233.         if (3 & (intptr_t) s->buf_ptr) {

libavcodec/bitstream.h:240:35: 
  238.         } else
  239. #endif
  240.         *(uint32_t *)s->buf_ptr = be2me_32(bit_buf);
                                         ^
  241.         //printf("bitbuf = %08x\n", bit_buf);
  242.         s->buf_ptr+=4;

libavcodec/bitstream.h:240:9: 
  238.         } else
  239. #endif
  240.         *(uint32_t *)s->buf_ptr = be2me_32(bit_buf);
               ^
  241.         //printf("bitbuf = %08x\n", bit_buf);
  242.         s->buf_ptr+=4;
