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

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

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

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

libavcodec/put_bits.h:52:1: start of procedure init_put_bits()
  50.  * @param buffer_size the size in bytes of buffer
  51.  */
  52. static inline void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size)
      ^
  53. {
  54.     if(buffer_size < 0) {

libavcodec/put_bits.h:54:8: Taking true branch
  52. static inline void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size)
  53. {
  54.     if(buffer_size < 0) {
             ^
  55.         buffer_size = 0;
  56.         buffer = NULL;

libavcodec/put_bits.h:55:9: 
  53. {
  54.     if(buffer_size < 0) {
  55.         buffer_size = 0;
              ^
  56.         buffer = NULL;
  57.     }

libavcodec/put_bits.h:56:9: 
  54.     if(buffer_size < 0) {
  55.         buffer_size = 0;
  56.         buffer = NULL;
              ^
  57.     }
  58. 

libavcodec/put_bits.h:59:5: 
  57.     }
  58. 
  59.     s->size_in_bits= 8*buffer_size;
          ^
  60.     s->buf = buffer;
  61.     s->buf_end = s->buf + buffer_size;

libavcodec/put_bits.h:60:5: 
  58. 
  59.     s->size_in_bits= 8*buffer_size;
  60.     s->buf = buffer;
          ^
  61.     s->buf_end = s->buf + buffer_size;
  62.     s->buf_ptr = s->buf;

libavcodec/put_bits.h:61:5: 
  59.     s->size_in_bits= 8*buffer_size;
  60.     s->buf = buffer;
  61.     s->buf_end = s->buf + buffer_size;
          ^
  62.     s->buf_ptr = s->buf;
  63.     s->bit_left=32;

libavcodec/put_bits.h:62:5: 
  60.     s->buf = buffer;
  61.     s->buf_end = s->buf + buffer_size;
  62.     s->buf_ptr = s->buf;
          ^
  63.     s->bit_left=32;
  64.     s->bit_buf=0;

libavcodec/put_bits.h:63:5: 
  61.     s->buf_end = s->buf + buffer_size;
  62.     s->buf_ptr = s->buf;
  63.     s->bit_left=32;
          ^
  64.     s->bit_buf=0;
  65. }

libavcodec/put_bits.h:64:5: 
  62.     s->buf_ptr = s->buf;
  63.     s->bit_left=32;
  64.     s->bit_buf=0;
          ^
  65. }
  66. 

libavcodec/put_bits.h:65:1: return from a call to init_put_bits
  63.     s->bit_left=32;
  64.     s->bit_buf=0;
  65. }
      ^
  66. 
  67. /**

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

libavcodec/put_bits.h:127:1: start of procedure put_bits()
  125.  * Use put_bits32 to write 32 bits.
  126.  */
  127. static inline void put_bits(PutBitContext *s, int n, unsigned int value)
       ^
  128. {
  129.     unsigned int bit_buf;

libavcodec/put_bits.h:133:5: 
  131. 
  132.     //    printf("put_bits=%d %x\n", n, value);
  133.     assert(n <= 31 && value < (1U << n));
           ^
  134. 
  135.     bit_buf = s->bit_buf;

libavcodec/put_bits.h:135:5: 
  133.     assert(n <= 31 && value < (1U << n));
  134. 
  135.     bit_buf = s->bit_buf;
           ^
  136.     bit_left = s->bit_left;
  137. 

libavcodec/put_bits.h:136:5: 
  134. 
  135.     bit_buf = s->bit_buf;
  136.     bit_left = s->bit_left;
           ^
  137. 
  138.     //    printf("n=%d value=%x cnt=%d buf=%x\n", n, value, bit_cnt, bit_buf);

libavcodec/put_bits.h:150:9: Taking true branch
  148.     bit_left-=n;
  149. #else
  150.     if (n < bit_left) {
               ^
  151.         bit_buf = (bit_buf<<n) | value;
  152.         bit_left-=n;

libavcodec/put_bits.h:151:9: 
  149. #else
  150.     if (n < bit_left) {
  151.         bit_buf = (bit_buf<<n) | value;
               ^
  152.         bit_left-=n;
  153.     } else {

libavcodec/put_bits.h:152:9: 
  150.     if (n < bit_left) {
  151.         bit_buf = (bit_buf<<n) | value;
  152.         bit_left-=n;
               ^
  153.     } else {
  154.         bit_buf<<=bit_left;

libavcodec/put_bits.h:164:5: 
  162. #endif
  163. 
  164.     s->bit_buf = bit_buf;
           ^
  165.     s->bit_left = bit_left;
  166. }

libavcodec/put_bits.h:165:5: 
  163. 
  164.     s->bit_buf = bit_buf;
  165.     s->bit_left = bit_left;
           ^
  166. }
  167. 

libavcodec/put_bits.h:166:1: return from a call to put_bits
  164.     s->bit_buf = bit_buf;
  165.     s->bit_left = bit_left;
  166. }
       ^
  167. 
  168. static inline void put_sbits(PutBitContext *pb, int n, int32_t value)

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

libavcodec/put_bits.h:127:1: start of procedure put_bits()
  125.  * Use put_bits32 to write 32 bits.
  126.  */
  127. static inline void put_bits(PutBitContext *s, int n, unsigned int value)
       ^
  128. {
  129.     unsigned int bit_buf;

libavcodec/put_bits.h:133:5: 
  131. 
  132.     //    printf("put_bits=%d %x\n", n, value);
  133.     assert(n <= 31 && value < (1U << n));
           ^
  134. 
  135.     bit_buf = s->bit_buf;

libavcodec/put_bits.h:135:5: 
  133.     assert(n <= 31 && value < (1U << n));
  134. 
  135.     bit_buf = s->bit_buf;
           ^
  136.     bit_left = s->bit_left;
  137. 

libavcodec/put_bits.h:136:5: 
  134. 
  135.     bit_buf = s->bit_buf;
  136.     bit_left = s->bit_left;
           ^
  137. 
  138.     //    printf("n=%d value=%x cnt=%d buf=%x\n", n, value, bit_cnt, bit_buf);

libavcodec/put_bits.h:150:9: Taking true branch
  148.     bit_left-=n;
  149. #else
  150.     if (n < bit_left) {
               ^
  151.         bit_buf = (bit_buf<<n) | value;
  152.         bit_left-=n;

libavcodec/put_bits.h:151:9: 
  149. #else
  150.     if (n < bit_left) {
  151.         bit_buf = (bit_buf<<n) | value;
               ^
  152.         bit_left-=n;
  153.     } else {

libavcodec/put_bits.h:152:9: 
  150.     if (n < bit_left) {
  151.         bit_buf = (bit_buf<<n) | value;
  152.         bit_left-=n;
               ^
  153.     } else {
  154.         bit_buf<<=bit_left;

libavcodec/put_bits.h:164:5: 
  162. #endif
  163. 
  164.     s->bit_buf = bit_buf;
           ^
  165.     s->bit_left = bit_left;
  166. }

libavcodec/put_bits.h:165:5: 
  163. 
  164.     s->bit_buf = bit_buf;
  165.     s->bit_left = bit_left;
           ^
  166. }
  167. 

libavcodec/put_bits.h:166:1: return from a call to put_bits
  164.     s->bit_buf = bit_buf;
  165.     s->bit_left = bit_left;
  166. }
       ^
  167. 
  168. static inline void put_sbits(PutBitContext *pb, int n, int32_t value)

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

libavcodec/put_bits.h:127:1: start of procedure put_bits()
  125.  * Use put_bits32 to write 32 bits.
  126.  */
  127. static inline void put_bits(PutBitContext *s, int n, unsigned int value)
       ^
  128. {
  129.     unsigned int bit_buf;

libavcodec/put_bits.h:133:5: 
  131. 
  132.     //    printf("put_bits=%d %x\n", n, value);
  133.     assert(n <= 31 && value < (1U << n));
           ^
  134. 
  135.     bit_buf = s->bit_buf;

libavcodec/put_bits.h:135:5: 
  133.     assert(n <= 31 && value < (1U << n));
  134. 
  135.     bit_buf = s->bit_buf;
           ^
  136.     bit_left = s->bit_left;
  137. 

libavcodec/put_bits.h:136:5: 
  134. 
  135.     bit_buf = s->bit_buf;
  136.     bit_left = s->bit_left;
           ^
  137. 
  138.     //    printf("n=%d value=%x cnt=%d buf=%x\n", n, value, bit_cnt, bit_buf);

libavcodec/put_bits.h:150:9: Taking true branch
  148.     bit_left-=n;
  149. #else
  150.     if (n < bit_left) {
               ^
  151.         bit_buf = (bit_buf<<n) | value;
  152.         bit_left-=n;

libavcodec/put_bits.h:151:9: 
  149. #else
  150.     if (n < bit_left) {
  151.         bit_buf = (bit_buf<<n) | value;
               ^
  152.         bit_left-=n;
  153.     } else {

libavcodec/put_bits.h:152:9: 
  150.     if (n < bit_left) {
  151.         bit_buf = (bit_buf<<n) | value;
  152.         bit_left-=n;
               ^
  153.     } else {
  154.         bit_buf<<=bit_left;

libavcodec/put_bits.h:164:5: 
  162. #endif
  163. 
  164.     s->bit_buf = bit_buf;
           ^
  165.     s->bit_left = bit_left;
  166. }

libavcodec/put_bits.h:165:5: 
  163. 
  164.     s->bit_buf = bit_buf;
  165.     s->bit_left = bit_left;
           ^
  166. }
  167. 

libavcodec/put_bits.h:166:1: return from a call to put_bits
  164.     s->bit_buf = bit_buf;
  165.     s->bit_left = bit_left;
  166. }
       ^
  167. 
  168. static inline void put_sbits(PutBitContext *pb, int n, int32_t value)

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

libavcodec/put_bits.h:127:1: start of procedure put_bits()
  125.  * Use put_bits32 to write 32 bits.
  126.  */
  127. static inline void put_bits(PutBitContext *s, int n, unsigned int value)
       ^
  128. {
  129.     unsigned int bit_buf;

libavcodec/put_bits.h:133:5: 
  131. 
  132.     //    printf("put_bits=%d %x\n", n, value);
  133.     assert(n <= 31 && value < (1U << n));
           ^
  134. 
  135.     bit_buf = s->bit_buf;

libavcodec/put_bits.h:135:5: 
  133.     assert(n <= 31 && value < (1U << n));
  134. 
  135.     bit_buf = s->bit_buf;
           ^
  136.     bit_left = s->bit_left;
  137. 

libavcodec/put_bits.h:136:5: 
  134. 
  135.     bit_buf = s->bit_buf;
  136.     bit_left = s->bit_left;
           ^
  137. 
  138.     //    printf("n=%d value=%x cnt=%d buf=%x\n", n, value, bit_cnt, bit_buf);

libavcodec/put_bits.h:150:9: Taking false branch
  148.     bit_left-=n;
  149. #else
  150.     if (n < bit_left) {
               ^
  151.         bit_buf = (bit_buf<<n) | value;
  152.         bit_left-=n;

libavcodec/put_bits.h:154:9: 
  152.         bit_left-=n;
  153.     } else {
  154.         bit_buf<<=bit_left;
               ^
  155.         bit_buf |= value >> (n - bit_left);
  156.         AV_WB32(s->buf_ptr, bit_buf);

libavcodec/put_bits.h:155:9: 
  153.     } else {
  154.         bit_buf<<=bit_left;
  155.         bit_buf |= value >> (n - bit_left);
               ^
  156.         AV_WB32(s->buf_ptr, bit_buf);
  157.         //printf("bitbuf = %08x\n", bit_buf);

libavcodec/put_bits.h:156:9: 
  154.         bit_buf<<=bit_left;
  155.         bit_buf |= value >> (n - bit_left);
  156.         AV_WB32(s->buf_ptr, bit_buf);
               ^
  157.         //printf("bitbuf = %08x\n", bit_buf);
  158.         s->buf_ptr+=4;
