libavcodec/flashsv.c:123: error: Null Dereference
  pointer `&gb->buffer` last assigned on line 120 could be null and is dereferenced by call to `get_bits()` at line 123, column 27.

libavcodec/flashsv.c:103:1: start of procedure flashsv_decode_frame()
101. 
102. 
103. static int flashsv_decode_frame(AVCodecContext *avctx,
     ^
104.                                     void *data, int *data_size,
105.                                     AVPacket *avpkt)

libavcodec/flashsv.c:107:5: 
105.                                     AVPacket *avpkt)
106. {
107.     const uint8_t *buf = avpkt->data;
         ^
108.     int buf_size = avpkt->size;
109.     FlashSVContext *s = avctx->priv_data;

libavcodec/flashsv.c:108:5: 
106. {
107.     const uint8_t *buf = avpkt->data;
108.     int buf_size = avpkt->size;
         ^
109.     FlashSVContext *s = avctx->priv_data;
110.     int h_blocks, v_blocks, h_part, v_part, i, j;

libavcodec/flashsv.c:109:5: 
107.     const uint8_t *buf = avpkt->data;
108.     int buf_size = avpkt->size;
109.     FlashSVContext *s = avctx->priv_data;
         ^
110.     int h_blocks, v_blocks, h_part, v_part, i, j;
111.     GetBitContext gb;

libavcodec/flashsv.c:114:9: Taking false branch
112. 
113.     /* no supplementary picture */
114.     if (buf_size == 0)
             ^
115.         return 0;
116. 

libavcodec/flashsv.c:117:8: Taking true branch
115.         return 0;
116. 
117.     if(s->frame.data[0])
            ^
118.             avctx->release_buffer(avctx, &s->frame);
119. 

libavcodec/flashsv.c:118:13: Skipping __function_pointer__(): unresolved function pointer
116. 
117.     if(s->frame.data[0])
118.             avctx->release_buffer(avctx, &s->frame);
                 ^
119. 
120.     init_get_bits(&gb, buf, buf_size * 8);

libavcodec/flashsv.c:120:5: 
118.             avctx->release_buffer(avctx, &s->frame);
119. 
120.     init_get_bits(&gb, buf, buf_size * 8);
         ^
121. 
122.     /* start to parse the bitstream */

libavcodec/get_bits.h:493:1: start of procedure init_get_bits()
  491.  * @param bit_size the size of the buffer in bits
  492.  */
  493. static inline void init_get_bits(GetBitContext *s,
       ^
  494.                    const uint8_t *buffer, int bit_size)
  495. {

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

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

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

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

libavcodec/get_bits.h:502:5: 
  500.     }
  501. 
  502.     s->buffer= buffer;
           ^
  503.     s->size_in_bits= bit_size;
  504.     s->buffer_end= buffer + buffer_size;

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

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

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

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

libavcodec/flashsv.c:123:5: 
121. 
122.     /* start to parse the bitstream */
123.     s->block_width = 16* (get_bits(&gb, 4)+1);
         ^
124.     s->image_width =     get_bits(&gb,12);
125.     s->block_height= 16* (get_bits(&gb, 4)+1);

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)

static int flashsv_decode_frame(AVCodecContext *avctx,
                                    void *data, int *data_size,
                                    AVPacket *avpkt)
{
    const uint8_t *buf = avpkt->data;
    int buf_size = avpkt->size;
    FlashSVContext *s = avctx->priv_data;
    int h_blocks, v_blocks, h_part, v_part, i, j;
    GetBitContext gb;
    if (buf_size == 0)
        return 0;
    if(s->frame.data[0])
            avctx->release_buffer(avctx, &s->frame);
    init_get_bits(&gb, buf, buf_size * 8);
    s->block_width = 16* (get_bits(&gb, 4)+1);
    s->image_width =     get_bits(&gb,12);
    s->block_height= 16* (get_bits(&gb, 4)+1);
    s->image_height=     get_bits(&gb,12);
    h_blocks = s->image_width / s->block_width;
    h_part = s->image_width % s->block_width;
    v_blocks = s->image_height / s->block_height;
    v_part = s->image_height % s->block_height;
    if(s->block_size < s->block_width*s->block_height) {
        if (s->tmpblock != NULL)
            av_free(s->tmpblock);
        if ((s->tmpblock = av_malloc(3*s->block_width*s->block_height)) == NULL) {
            av_log(avctx, AV_LOG_ERROR, "Can't allocate decompression buffer.\n");
            return -1;
        }
    }
    s->block_size = s->block_width*s->block_height;
    if((avctx->width==0) && (avctx->height==0)){
        avctx->width = s->image_width;
        avctx->height = s->image_height;
    }
    if ((avctx->width != s->image_width) || (avctx->height != s->image_height)) {
        av_log(avctx, AV_LOG_ERROR, "Frame width or height differs from first frames!\n");
        av_log(avctx, AV_LOG_ERROR, "fh = %d, fv %d  vs  ch = %d, cv = %d\n",avctx->height,
        avctx->width,s->image_height,s->image_width);
        return -1;
    }
    av_log(avctx, AV_LOG_DEBUG, "image: %dx%d block: %dx%d num: %dx%d part: %dx%d\n",
        s->image_width, s->image_height, s->block_width, s->block_height,
        h_blocks, v_blocks, h_part, v_part);
    s->frame.reference = 1;
    s->frame.buffer_hints = FF_BUFFER_HINTS_VALID;
    if (avctx->get_buffer(avctx, &s->frame) < 0) {
        av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n");
        return -1;
    }
    for (j = 0; j < v_blocks + (v_part?1:0); j++)
    {
        int hp = j*s->block_height;
        int hs = (j<v_blocks)?s->block_height:v_part;
        for (i = 0; i < h_blocks + (h_part?1:0); i++)
        {
            int wp = i*s->block_width;
            int ws = (i<h_blocks)?s->block_width:h_part;
            int size = get_bits(&gb, 16);
            if (size == 0) {
            } else {
                int ret = inflateReset(&(s->zstream));
                if (ret != Z_OK)
                {
                    av_log(avctx, AV_LOG_ERROR, "error in decompression (reset) of block %dx%d\n", i, j);
                }
                s->zstream.next_in = buf+(get_bits_count(&gb)/8);
                s->zstream.avail_in = size;
                s->zstream.next_out = s->tmpblock;
                s->zstream.avail_out = s->block_size*3;
                ret = inflate(&(s->zstream), Z_FINISH);
                if (ret == Z_DATA_ERROR)
                {
                    av_log(avctx, AV_LOG_ERROR, "Zlib resync occurred\n");
                    inflateSync(&(s->zstream));
                    ret = inflate(&(s->zstream), Z_FINISH);
                }
                if ((ret != Z_OK) && (ret != Z_STREAM_END))
                {
                    av_log(avctx, AV_LOG_ERROR, "error in decompression of block %dx%d: %d\n", i, j, ret);
                }
                copy_region(s->tmpblock, s->frame.data[0], s->image_height-(hp+hs+1), wp, hs, ws, s->frame.linesize[0]);
                skip_bits_long(&gb, 8*size);
            }
        }
    }
    *data_size = sizeof(AVFrame);
    *(AVFrame*)data = s->frame;
    if ((get_bits_count(&gb)/8) != buf_size)
        av_log(avctx, AV_LOG_ERROR, "buffer not fully consumed (%d != %d)\n",
            buf_size, (get_bits_count(&gb)/8));
    return buf_size;
}
['static int flashsv_decode_frame(AVCodecContext *avctx,\n                                    void *data, int *data_size,\n                                    AVPacket *avpkt)\n{\n    const uint8_t *buf = avpkt->data;\n    int buf_size = avpkt->size;\n    FlashSVContext *s = avctx->priv_data;\n    int h_blocks, v_blocks, h_part, v_part, i, j;\n    GetBitContext gb;\n    if (buf_size == 0)\n        return 0;\n    if(s->frame.data[0])\n            avctx->release_buffer(avctx, &s->frame);\n    init_get_bits(&gb, buf, buf_size * 8);\n    s->block_width = 16* (get_bits(&gb, 4)+1);\n    s->image_width =     get_bits(&gb,12);\n    s->block_height= 16* (get_bits(&gb, 4)+1);\n    s->image_height=     get_bits(&gb,12);\n    h_blocks = s->image_width / s->block_width;\n    h_part = s->image_width % s->block_width;\n    v_blocks = s->image_height / s->block_height;\n    v_part = s->image_height % s->block_height;\n    if(s->block_size < s->block_width*s->block_height) {\n        if (s->tmpblock != NULL)\n            av_free(s->tmpblock);\n        if ((s->tmpblock = av_malloc(3*s->block_width*s->block_height)) == NULL) {\n            av_log(avctx, AV_LOG_ERROR, "Can\'t allocate decompression buffer.\\n");\n            return -1;\n        }\n    }\n    s->block_size = s->block_width*s->block_height;\n    if((avctx->width==0) && (avctx->height==0)){\n        avctx->width = s->image_width;\n        avctx->height = s->image_height;\n    }\n    if ((avctx->width != s->image_width) || (avctx->height != s->image_height)) {\n        av_log(avctx, AV_LOG_ERROR, "Frame width or height differs from first frames!\\n");\n        av_log(avctx, AV_LOG_ERROR, "fh = %d, fv %d  vs  ch = %d, cv = %d\\n",avctx->height,\n        avctx->width,s->image_height,s->image_width);\n        return -1;\n    }\n    av_log(avctx, AV_LOG_DEBUG, "image: %dx%d block: %dx%d num: %dx%d part: %dx%d\\n",\n        s->image_width, s->image_height, s->block_width, s->block_height,\n        h_blocks, v_blocks, h_part, v_part);\n    s->frame.reference = 1;\n    s->frame.buffer_hints = FF_BUFFER_HINTS_VALID;\n    if (avctx->get_buffer(avctx, &s->frame) < 0) {\n        av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\\n");\n        return -1;\n    }\n    for (j = 0; j < v_blocks + (v_part?1:0); j++)\n    {\n        int hp = j*s->block_height;\n        int hs = (j<v_blocks)?s->block_height:v_part;\n        for (i = 0; i < h_blocks + (h_part?1:0); i++)\n        {\n            int wp = i*s->block_width;\n            int ws = (i<h_blocks)?s->block_width:h_part;\n            int size = get_bits(&gb, 16);\n            if (size == 0) {\n            } else {\n                int ret = inflateReset(&(s->zstream));\n                if (ret != Z_OK)\n                {\n                    av_log(avctx, AV_LOG_ERROR, "error in decompression (reset) of block %dx%d\\n", i, j);\n                }\n                s->zstream.next_in = buf+(get_bits_count(&gb)/8);\n                s->zstream.avail_in = size;\n                s->zstream.next_out = s->tmpblock;\n                s->zstream.avail_out = s->block_size*3;\n                ret = inflate(&(s->zstream), Z_FINISH);\n                if (ret == Z_DATA_ERROR)\n                {\n                    av_log(avctx, AV_LOG_ERROR, "Zlib resync occurred\\n");\n                    inflateSync(&(s->zstream));\n                    ret = inflate(&(s->zstream), Z_FINISH);\n                }\n                if ((ret != Z_OK) && (ret != Z_STREAM_END))\n                {\n                    av_log(avctx, AV_LOG_ERROR, "error in decompression of block %dx%d: %d\\n", i, j, ret);\n                }\n                copy_region(s->tmpblock, s->frame.data[0], s->image_height-(hp+hs+1), wp, hs, ws, s->frame.linesize[0]);\n                skip_bits_long(&gb, 8*size);\n            }\n        }\n    }\n    *data_size = sizeof(AVFrame);\n    *(AVFrame*)data = s->frame;\n    if ((get_bits_count(&gb)/8) != buf_size)\n        av_log(avctx, AV_LOG_ERROR, "buffer not fully consumed (%d != %d)\\n",\n            buf_size, (get_bits_count(&gb)/8));\n    return buf_size;\n}', 'static inline void init_get_bits(GetBitContext *s,\n                   const uint8_t *buffer, int bit_size)\n{\n    int buffer_size= (bit_size+7)>>3;\n    if(buffer_size < 0 || bit_size < 0) {\n        buffer_size = bit_size = 0;\n        buffer = NULL;\n    }\n    s->buffer= buffer;\n    s->size_in_bits= bit_size;\n    s->buffer_end= buffer + buffer_size;\n#ifdef ALT_BITSTREAM_READER\n    s->index=0;\n#elif defined LIBMPEG2_BITSTREAM_READER\n    s->buffer_ptr = (uint8_t*)((intptr_t)buffer&(~1));\n    s->bit_count = 16 + 8*((intptr_t)buffer&1);\n    skip_bits_long(s, 0);\n#elif defined A32_BITSTREAM_READER\n    s->buffer_ptr = (uint32_t*)((intptr_t)buffer&(~3));\n    s->bit_count = 32 + 8*((intptr_t)buffer&3);\n    skip_bits_long(s, 0);\n#endif\n}', 'static inline unsigned int get_bits(GetBitContext *s, int n){\n    register int tmp;\n    OPEN_READER(re, s)\n    UPDATE_CACHE(re, s)\n    tmp= SHOW_UBITS(re, s, n);\n    LAST_SKIP_BITS(re, s, n)\n    CLOSE_READER(re, s)\n    return tmp;\n}']