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

libavcodec/ra144.c:289:1: start of procedure ra144_decode_frame()
287. 
288. /** Uncompress one block (20 bytes -> 160*2 bytes). */
289. static int ra144_decode_frame(AVCodecContext * avctx, void *vdata,
     ^
290.                               int *data_size, const uint8_t *buf, int buf_size)
291. {

libavcodec/ra144.c:292:5: 
290.                               int *data_size, const uint8_t *buf, int buf_size)
291. {
292.     static const uint8_t sizes[10] = {6, 5, 5, 4, 4, 3, 3, 3, 3, 2};
         ^
293.     unsigned int refl_rms[4];    // RMS of the reflection coefficients
294.     uint16_t block_coefs[4][30]; // LPC coefficients of each sub-block

libavcodec/ra144.c:297:5: 
295.     unsigned int lpc_refl[10];   // LPC reflection coefficients of the frame
296.     int i, j;
297.     int16_t *data = vdata;
         ^
298.     unsigned int energy;
299. 

libavcodec/ra144.c:300:5: 
298.     unsigned int energy;
299. 
300.     RA144Context *ractx = avctx->priv_data;
         ^
301.     GetBitContext gb;
302. 

libavcodec/ra144.c:303:9: Taking false branch
301.     GetBitContext gb;
302. 
303.     if (*data_size < 2*160)
             ^
304.         return -1;
305. 

libavcodec/ra144.c:306:8: Taking false branch
304.         return -1;
305. 
306.     if(buf_size < 20) {
            ^
307.         av_log(avctx, AV_LOG_ERROR,
308.                "Frame too small (%d bytes). Truncated file?\n", buf_size);

libavcodec/ra144.c:312:5: 
310.         return buf_size;
311.     }
312.     init_get_bits(&gb, buf, 20 * 8);
         ^
313. 
314.     for (i=0; i<10; i++)

libavcodec/bitstream.h:737:1: start of procedure init_get_bits()
  735.  * @param bit_size the size of the buffer in bits
  736.  */
  737. static inline void init_get_bits(GetBitContext *s,
       ^
  738.                    const uint8_t *buffer, int bit_size)
  739. {

libavcodec/bitstream.h:740:5: 
  738.                    const uint8_t *buffer, int bit_size)
  739. {
  740.     int buffer_size= (bit_size+7)>>3;
           ^
  741.     if(buffer_size < 0 || bit_size < 0) {
  742.         buffer_size = bit_size = 0;

libavcodec/bitstream.h:741:8: Taking true branch
  739. {
  740.     int buffer_size= (bit_size+7)>>3;
  741.     if(buffer_size < 0 || bit_size < 0) {
              ^
  742.         buffer_size = bit_size = 0;
  743.         buffer = NULL;

libavcodec/bitstream.h:742:9: 
  740.     int buffer_size= (bit_size+7)>>3;
  741.     if(buffer_size < 0 || bit_size < 0) {
  742.         buffer_size = bit_size = 0;
               ^
  743.         buffer = NULL;
  744.     }

libavcodec/bitstream.h:743:9: 
  741.     if(buffer_size < 0 || bit_size < 0) {
  742.         buffer_size = bit_size = 0;
  743.         buffer = NULL;
               ^
  744.     }
  745. 

libavcodec/bitstream.h:746:5: 
  744.     }
  745. 
  746.     s->buffer= buffer;
           ^
  747.     s->size_in_bits= bit_size;
  748.     s->buffer_end= buffer + buffer_size;

libavcodec/bitstream.h:747:5: 
  745. 
  746.     s->buffer= buffer;
  747.     s->size_in_bits= bit_size;
           ^
  748.     s->buffer_end= buffer + buffer_size;
  749. #ifdef ALT_BITSTREAM_READER

libavcodec/bitstream.h:748:5: 
  746.     s->buffer= buffer;
  747.     s->size_in_bits= bit_size;
  748.     s->buffer_end= buffer + buffer_size;
           ^
  749. #ifdef ALT_BITSTREAM_READER
  750.     s->index=0;

libavcodec/bitstream.h:750:5: 
  748.     s->buffer_end= buffer + buffer_size;
  749. #ifdef ALT_BITSTREAM_READER
  750.     s->index=0;
           ^
  751. #elif defined LIBMPEG2_BITSTREAM_READER
  752.     s->buffer_ptr = (uint8_t*)((intptr_t)buffer&(~1));

libavcodec/bitstream.h:760:1: return from a call to init_get_bits
  758.     skip_bits_long(s, 0);
  759. #endif
  760. }
       ^
  761. 
  762. static inline void align_get_bits(GetBitContext *s)

libavcodec/ra144.c:314:10: 
312.     init_get_bits(&gb, buf, 20 * 8);
313. 
314.     for (i=0; i<10; i++)
              ^
315.         lpc_refl[i] = lpc_refl_cb[i][get_bits(&gb, sizes[i])];
316. 

libavcodec/ra144.c:314:15: Loop condition is true. Entering loop body
312.     init_get_bits(&gb, buf, 20 * 8);
313. 
314.     for (i=0; i<10; i++)
                   ^
315.         lpc_refl[i] = lpc_refl_cb[i][get_bits(&gb, sizes[i])];
316. 

libavcodec/ra144.c:315:9: 
313. 
314.     for (i=0; i<10; i++)
315.         lpc_refl[i] = lpc_refl_cb[i][get_bits(&gb, sizes[i])];
             ^
316. 
317.     eval_coefs(ractx->lpc_coef[0], lpc_refl);

libavcodec/bitstream.h:634:1: start of procedure get_bits()
  632.  * Note, the alt bitstream reader can read up to 25 bits, but the libmpeg2 reader can't
  633.  */
  634. static inline unsigned int get_bits(GetBitContext *s, int n){
       ^
  635.     register int tmp;
  636.     OPEN_READER(re, s)

libavcodec/bitstream.h:636:5: 
  634. static inline unsigned int get_bits(GetBitContext *s, int n){
  635.     register int tmp;
  636.     OPEN_READER(re, s)
           ^
  637.     UPDATE_CACHE(re, s)
  638.     tmp= SHOW_UBITS(re, s, n);

libavcodec/bitstream.h:637:5: 
  635.     register int tmp;
  636.     OPEN_READER(re, s)
  637.     UPDATE_CACHE(re, s)
           ^
  638.     tmp= SHOW_UBITS(re, s, n);
  639.     LAST_SKIP_BITS(re, s, n)

static int ra144_decode_frame(AVCodecContext * avctx, void *vdata,
                              int *data_size, const uint8_t *buf, int buf_size)
{
    static const uint8_t sizes[10] = {6, 5, 5, 4, 4, 3, 3, 3, 3, 2};
    unsigned int refl_rms[4];
    uint16_t block_coefs[4][30];
    unsigned int lpc_refl[10];
    int i, j;
    int16_t *data = vdata;
    unsigned int energy;
    RA144Context *ractx = avctx->priv_data;
    GetBitContext gb;
    if (*data_size < 2*160)
        return -1;
    if(buf_size < 20) {
        av_log(avctx, AV_LOG_ERROR,
               "Frame too small (%d bytes). Truncated file?\n", buf_size);
        *data_size = 0;
        return buf_size;
    }
    init_get_bits(&gb, buf, 20 * 8);
    for (i=0; i<10; i++)
        lpc_refl[i] = lpc_refl_cb[i][get_bits(&gb, sizes[i])];
    eval_coefs(ractx->lpc_coef[0], lpc_refl);
    ractx->lpc_refl_rms[0] = rms(lpc_refl);
    energy = energy_tab[get_bits(&gb, 5)];
    refl_rms[0] = interp(ractx, block_coefs[0], 1, 1, ractx->old_energy);
    refl_rms[1] = interp(ractx, block_coefs[1], 2, energy <= ractx->old_energy,
                    t_sqrt(energy*ractx->old_energy) >> 12);
    refl_rms[2] = interp(ractx, block_coefs[2], 3, 0, energy);
    refl_rms[3] = rescale_rms(ractx->lpc_refl_rms[0], energy);
    int_to_int16(block_coefs[3], ractx->lpc_coef[0]);
    for (i=0; i < 4; i++) {
        do_output_subblock(ractx, block_coefs[i], refl_rms[i], &gb);
        for (j=0; j < BLOCKSIZE; j++)
            *data++ = av_clip_int16(ractx->curr_sblock[j + 10] << 2);
    }
    ractx->old_energy = energy;
    ractx->lpc_refl_rms[1] = ractx->lpc_refl_rms[0];
    FFSWAP(unsigned int *, ractx->lpc_coef[0], ractx->lpc_coef[1]);
    *data_size = 2*160;
    return 20;
}
['static int ra144_decode_frame(AVCodecContext * avctx, void *vdata,\n                              int *data_size, const uint8_t *buf, int buf_size)\n{\n    static const uint8_t sizes[10] = {6, 5, 5, 4, 4, 3, 3, 3, 3, 2};\n    unsigned int refl_rms[4];\n    uint16_t block_coefs[4][30];\n    unsigned int lpc_refl[10];\n    int i, j;\n    int16_t *data = vdata;\n    unsigned int energy;\n    RA144Context *ractx = avctx->priv_data;\n    GetBitContext gb;\n    if (*data_size < 2*160)\n        return -1;\n    if(buf_size < 20) {\n        av_log(avctx, AV_LOG_ERROR,\n               "Frame too small (%d bytes). Truncated file?\\n", buf_size);\n        *data_size = 0;\n        return buf_size;\n    }\n    init_get_bits(&gb, buf, 20 * 8);\n    for (i=0; i<10; i++)\n        lpc_refl[i] = lpc_refl_cb[i][get_bits(&gb, sizes[i])];\n    eval_coefs(ractx->lpc_coef[0], lpc_refl);\n    ractx->lpc_refl_rms[0] = rms(lpc_refl);\n    energy = energy_tab[get_bits(&gb, 5)];\n    refl_rms[0] = interp(ractx, block_coefs[0], 1, 1, ractx->old_energy);\n    refl_rms[1] = interp(ractx, block_coefs[1], 2, energy <= ractx->old_energy,\n                    t_sqrt(energy*ractx->old_energy) >> 12);\n    refl_rms[2] = interp(ractx, block_coefs[2], 3, 0, energy);\n    refl_rms[3] = rescale_rms(ractx->lpc_refl_rms[0], energy);\n    int_to_int16(block_coefs[3], ractx->lpc_coef[0]);\n    for (i=0; i < 4; i++) {\n        do_output_subblock(ractx, block_coefs[i], refl_rms[i], &gb);\n        for (j=0; j < BLOCKSIZE; j++)\n            *data++ = av_clip_int16(ractx->curr_sblock[j + 10] << 2);\n    }\n    ractx->old_energy = energy;\n    ractx->lpc_refl_rms[1] = ractx->lpc_refl_rms[0];\n    FFSWAP(unsigned int *, ractx->lpc_coef[0], ractx->lpc_coef[1]);\n    *data_size = 2*160;\n    return 20;\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}']