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

libavcodec/vp3.c:1799:1: start of procedure vp3_decode_frame()
1797.  * This is the ffmpeg/libavcodec API frame decode function.
1798.  */
1799. static int vp3_decode_frame(AVCodecContext *avctx,
      ^
1800.                             void *data, int *data_size,
1801.                             AVPacket *avpkt)

libavcodec/vp3.c:1803:5: 
1801.                             AVPacket *avpkt)
1802. {
1803.     const uint8_t *buf = avpkt->data;
          ^
1804.     int buf_size = avpkt->size;
1805.     Vp3DecodeContext *s = avctx->priv_data;

libavcodec/vp3.c:1804:5: 
1802. {
1803.     const uint8_t *buf = avpkt->data;
1804.     int buf_size = avpkt->size;
          ^
1805.     Vp3DecodeContext *s = avctx->priv_data;
1806.     GetBitContext gb;

libavcodec/vp3.c:1805:5: 
1803.     const uint8_t *buf = avpkt->data;
1804.     int buf_size = avpkt->size;
1805.     Vp3DecodeContext *s = avctx->priv_data;
          ^
1806.     GetBitContext gb;
1807.     static int counter = 0;

libavcodec/vp3.c:1807:5: 
1805.     Vp3DecodeContext *s = avctx->priv_data;
1806.     GetBitContext gb;
1807.     static int counter = 0;
          ^
1808.     int i;
1809. 

libavcodec/vp3.c:1810:5: 
1808.     int i;
1809. 
1810.     init_get_bits(&gb, buf, buf_size * 8);
          ^
1811. 
1812.     if (s->theora && get_bits1(&gb))

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/vp3.c:1812:9: Taking false branch
1810.     init_get_bits(&gb, buf, buf_size * 8);
1811. 
1812.     if (s->theora && get_bits1(&gb))
              ^
1813.     {
1814.         av_log(avctx, AV_LOG_ERROR, "Header packet passed to frame decoder, skipping\n");

libavcodec/vp3.c:1818:20: 
1816.     }
1817. 
1818.     s->keyframe = !get_bits1(&gb);
                         ^
1819.     if (!s->theora)
1820.         skip_bits(&gb, 1);

libavcodec/get_bits.h:416:1: start of procedure get_bits1()
  414. }
  415. 
  416. static inline unsigned int get_bits1(GetBitContext *s){
       ^
  417. #ifdef ALT_BITSTREAM_READER
  418.     int index= s->index;

libavcodec/get_bits.h:418:5: 
  416. static inline unsigned int get_bits1(GetBitContext *s){
  417. #ifdef ALT_BITSTREAM_READER
  418.     int index= s->index;
           ^
  419.     uint8_t result= s->buffer[ index>>3 ];
  420. #ifdef ALT_BITSTREAM_READER_LE

libavcodec/get_bits.h:419:5: 
  417. #ifdef ALT_BITSTREAM_READER
  418.     int index= s->index;
  419.     uint8_t result= s->buffer[ index>>3 ];
           ^
  420. #ifdef ALT_BITSTREAM_READER_LE
  421.     result>>= (index&0x07);

static int vp3_decode_frame(AVCodecContext *avctx,
                            void *data, int *data_size,
                            AVPacket *avpkt)
{
    const uint8_t *buf = avpkt->data;
    int buf_size = avpkt->size;
    Vp3DecodeContext *s = avctx->priv_data;
    GetBitContext gb;
    static int counter = 0;
    int i;
    init_get_bits(&gb, buf, buf_size * 8);
    if (s->theora && get_bits1(&gb))
    {
        av_log(avctx, AV_LOG_ERROR, "Header packet passed to frame decoder, skipping\n");
        return -1;
    }
    s->keyframe = !get_bits1(&gb);
    if (!s->theora)
        skip_bits(&gb, 1);
    s->last_quality_index = s->quality_index;
    s->nqis=0;
    do{
        s->qis[s->nqis++]= get_bits(&gb, 6);
    } while(s->theora >= 0x030200 && s->nqis<3 && get_bits1(&gb));
    s->quality_index= s->qis[0];
    if (s->avctx->debug & FF_DEBUG_PICT_INFO)
        av_log(s->avctx, AV_LOG_INFO, " VP3 %sframe #%d: Q index = %d\n",
            s->keyframe?"key":"", counter, s->quality_index);
    counter++;
    if (s->quality_index != s->last_quality_index) {
        init_dequantizer(s);
        init_loop_filter(s);
    }
    if (avctx->skip_frame >= AVDISCARD_NONKEY && !s->keyframe)
        return buf_size;
    if (s->keyframe) {
        if (!s->theora)
        {
            skip_bits(&gb, 4);
            skip_bits(&gb, 4);
            if (s->version)
            {
                s->version = get_bits(&gb, 5);
                if (counter == 1)
                    av_log(s->avctx, AV_LOG_DEBUG, "VP version: %d\n", s->version);
            }
        }
        if (s->version || s->theora)
        {
                if (get_bits1(&gb))
                    av_log(s->avctx, AV_LOG_ERROR, "Warning, unsupported keyframe coding type?!\n");
            skip_bits(&gb, 2);
        }
        if (s->last_frame.data[0] == s->golden_frame.data[0]) {
            if (s->golden_frame.data[0])
                avctx->release_buffer(avctx, &s->golden_frame);
            s->last_frame= s->golden_frame;
        } else {
            if (s->golden_frame.data[0])
                avctx->release_buffer(avctx, &s->golden_frame);
            if (s->last_frame.data[0])
                avctx->release_buffer(avctx, &s->last_frame);
        }
        s->golden_frame.reference = 3;
        if(avctx->get_buffer(avctx, &s->golden_frame) < 0) {
            av_log(s->avctx, AV_LOG_ERROR, "vp3: get_buffer() failed\n");
            return -1;
        }
        s->current_frame= s->golden_frame;
        if (!s->pixel_addresses_initialized)
        {
            vp3_calculate_pixel_addresses(s);
            s->pixel_addresses_initialized = 1;
        }
    } else {
        s->current_frame.reference = 3;
        if (!s->pixel_addresses_initialized) {
            av_log(s->avctx, AV_LOG_ERROR, "vp3: first frame not a keyframe\n");
            return -1;
        }
        if(avctx->get_buffer(avctx, &s->current_frame) < 0) {
            av_log(s->avctx, AV_LOG_ERROR, "vp3: get_buffer() failed\n");
            return -1;
        }
    }
    s->current_frame.qscale_table= s->qscale_table;
    s->current_frame.qstride= 0;
    init_frame(s, &gb);
    if (unpack_superblocks(s, &gb)){
        av_log(s->avctx, AV_LOG_ERROR, "error in unpack_superblocks\n");
        return -1;
    }
    if (unpack_modes(s, &gb)){
        av_log(s->avctx, AV_LOG_ERROR, "error in unpack_modes\n");
        return -1;
    }
    if (unpack_vectors(s, &gb)){
        av_log(s->avctx, AV_LOG_ERROR, "error in unpack_vectors\n");
        return -1;
    }
    if (unpack_dct_coeffs(s, &gb)){
        av_log(s->avctx, AV_LOG_ERROR, "error in unpack_dct_coeffs\n");
        return -1;
    }
    reverse_dc_prediction(s, 0, s->fragment_width, s->fragment_height);
    if ((avctx->flags & CODEC_FLAG_GRAY) == 0) {
        reverse_dc_prediction(s, s->fragment_start[1],
            s->fragment_width / 2, s->fragment_height / 2);
        reverse_dc_prediction(s, s->fragment_start[2],
            s->fragment_width / 2, s->fragment_height / 2);
    }
    for (i = 0; i < s->macroblock_height; i++)
        render_slice(s, i);
    apply_loop_filter(s);
    *data_size=sizeof(AVFrame);
    *(AVFrame*)data= s->current_frame;
    if ((s->last_frame.data[0]) &&
        (s->last_frame.data[0] != s->golden_frame.data[0]))
        avctx->release_buffer(avctx, &s->last_frame);
    s->last_frame= s->current_frame;
    s->current_frame.data[0]= NULL;
    return buf_size;
}
['static int vp3_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    Vp3DecodeContext *s = avctx->priv_data;\n    GetBitContext gb;\n    static int counter = 0;\n    int i;\n    init_get_bits(&gb, buf, buf_size * 8);\n    if (s->theora && get_bits1(&gb))\n    {\n        av_log(avctx, AV_LOG_ERROR, "Header packet passed to frame decoder, skipping\\n");\n        return -1;\n    }\n    s->keyframe = !get_bits1(&gb);\n    if (!s->theora)\n        skip_bits(&gb, 1);\n    s->last_quality_index = s->quality_index;\n    s->nqis=0;\n    do{\n        s->qis[s->nqis++]= get_bits(&gb, 6);\n    } while(s->theora >= 0x030200 && s->nqis<3 && get_bits1(&gb));\n    s->quality_index= s->qis[0];\n    if (s->avctx->debug & FF_DEBUG_PICT_INFO)\n        av_log(s->avctx, AV_LOG_INFO, " VP3 %sframe #%d: Q index = %d\\n",\n            s->keyframe?"key":"", counter, s->quality_index);\n    counter++;\n    if (s->quality_index != s->last_quality_index) {\n        init_dequantizer(s);\n        init_loop_filter(s);\n    }\n    if (avctx->skip_frame >= AVDISCARD_NONKEY && !s->keyframe)\n        return buf_size;\n    if (s->keyframe) {\n        if (!s->theora)\n        {\n            skip_bits(&gb, 4);\n            skip_bits(&gb, 4);\n            if (s->version)\n            {\n                s->version = get_bits(&gb, 5);\n                if (counter == 1)\n                    av_log(s->avctx, AV_LOG_DEBUG, "VP version: %d\\n", s->version);\n            }\n        }\n        if (s->version || s->theora)\n        {\n                if (get_bits1(&gb))\n                    av_log(s->avctx, AV_LOG_ERROR, "Warning, unsupported keyframe coding type?!\\n");\n            skip_bits(&gb, 2);\n        }\n        if (s->last_frame.data[0] == s->golden_frame.data[0]) {\n            if (s->golden_frame.data[0])\n                avctx->release_buffer(avctx, &s->golden_frame);\n            s->last_frame= s->golden_frame;\n        } else {\n            if (s->golden_frame.data[0])\n                avctx->release_buffer(avctx, &s->golden_frame);\n            if (s->last_frame.data[0])\n                avctx->release_buffer(avctx, &s->last_frame);\n        }\n        s->golden_frame.reference = 3;\n        if(avctx->get_buffer(avctx, &s->golden_frame) < 0) {\n            av_log(s->avctx, AV_LOG_ERROR, "vp3: get_buffer() failed\\n");\n            return -1;\n        }\n        s->current_frame= s->golden_frame;\n        if (!s->pixel_addresses_initialized)\n        {\n            vp3_calculate_pixel_addresses(s);\n            s->pixel_addresses_initialized = 1;\n        }\n    } else {\n        s->current_frame.reference = 3;\n        if (!s->pixel_addresses_initialized) {\n            av_log(s->avctx, AV_LOG_ERROR, "vp3: first frame not a keyframe\\n");\n            return -1;\n        }\n        if(avctx->get_buffer(avctx, &s->current_frame) < 0) {\n            av_log(s->avctx, AV_LOG_ERROR, "vp3: get_buffer() failed\\n");\n            return -1;\n        }\n    }\n    s->current_frame.qscale_table= s->qscale_table;\n    s->current_frame.qstride= 0;\n    init_frame(s, &gb);\n    if (unpack_superblocks(s, &gb)){\n        av_log(s->avctx, AV_LOG_ERROR, "error in unpack_superblocks\\n");\n        return -1;\n    }\n    if (unpack_modes(s, &gb)){\n        av_log(s->avctx, AV_LOG_ERROR, "error in unpack_modes\\n");\n        return -1;\n    }\n    if (unpack_vectors(s, &gb)){\n        av_log(s->avctx, AV_LOG_ERROR, "error in unpack_vectors\\n");\n        return -1;\n    }\n    if (unpack_dct_coeffs(s, &gb)){\n        av_log(s->avctx, AV_LOG_ERROR, "error in unpack_dct_coeffs\\n");\n        return -1;\n    }\n    reverse_dc_prediction(s, 0, s->fragment_width, s->fragment_height);\n    if ((avctx->flags & CODEC_FLAG_GRAY) == 0) {\n        reverse_dc_prediction(s, s->fragment_start[1],\n            s->fragment_width / 2, s->fragment_height / 2);\n        reverse_dc_prediction(s, s->fragment_start[2],\n            s->fragment_width / 2, s->fragment_height / 2);\n    }\n    for (i = 0; i < s->macroblock_height; i++)\n        render_slice(s, i);\n    apply_loop_filter(s);\n    *data_size=sizeof(AVFrame);\n    *(AVFrame*)data= s->current_frame;\n    if ((s->last_frame.data[0]) &&\n        (s->last_frame.data[0] != s->golden_frame.data[0]))\n        avctx->release_buffer(avctx, &s->last_frame);\n    s->last_frame= s->current_frame;\n    s->current_frame.data[0]= NULL;\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_bits1(GetBitContext *s){\n#ifdef ALT_BITSTREAM_READER\n    int index= s->index;\n    uint8_t result= s->buffer[ index>>3 ];\n#ifdef ALT_BITSTREAM_READER_LE\n    result>>= (index&0x07);\n    result&= 1;\n#else\n    result<<= (index&0x07);\n    result>>= 8 - 1;\n#endif\n    index++;\n    s->index= index;\n    return result;\n#else\n    return get_bits(s, 1);\n#endif\n}']