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

libavcodec/smacker.c:275:1: start of procedure decode_header_trees()
273. }
274. 
275. static int decode_header_trees(SmackVContext *smk) {
     ^
276.     GetBitContext gb;
277.     int mmap_size, mclr_size, full_size, type_size;

libavcodec/smacker.c:279:5: 
277.     int mmap_size, mclr_size, full_size, type_size;
278. 
279.     mmap_size = AV_RL32(smk->avctx->extradata);
         ^
280.     mclr_size = AV_RL32(smk->avctx->extradata + 4);
281.     full_size = AV_RL32(smk->avctx->extradata + 8);

libavcodec/smacker.c:280:5: 
278. 
279.     mmap_size = AV_RL32(smk->avctx->extradata);
280.     mclr_size = AV_RL32(smk->avctx->extradata + 4);
         ^
281.     full_size = AV_RL32(smk->avctx->extradata + 8);
282.     type_size = AV_RL32(smk->avctx->extradata + 12);

libavcodec/smacker.c:281:5: 
279.     mmap_size = AV_RL32(smk->avctx->extradata);
280.     mclr_size = AV_RL32(smk->avctx->extradata + 4);
281.     full_size = AV_RL32(smk->avctx->extradata + 8);
         ^
282.     type_size = AV_RL32(smk->avctx->extradata + 12);
283. 

libavcodec/smacker.c:282:5: 
280.     mclr_size = AV_RL32(smk->avctx->extradata + 4);
281.     full_size = AV_RL32(smk->avctx->extradata + 8);
282.     type_size = AV_RL32(smk->avctx->extradata + 12);
         ^
283. 
284.     init_get_bits(&gb, smk->avctx->extradata + 16, (smk->avctx->extradata_size - 16) * 8);

libavcodec/smacker.c:284:5: 
282.     type_size = AV_RL32(smk->avctx->extradata + 12);
283. 
284.     init_get_bits(&gb, smk->avctx->extradata + 16, (smk->avctx->extradata_size - 16) * 8);
         ^
285. 
286.     if(!get_bits1(&gb)) {

libavcodec/bitstream.h:758:1: start of procedure init_get_bits()
  756.  * @param bit_size the size of the buffer in bits
  757.  */
  758. static inline void init_get_bits(GetBitContext *s,
       ^
  759.                    const uint8_t *buffer, int bit_size)
  760. {

libavcodec/bitstream.h:761:5: 
  759.                    const uint8_t *buffer, int bit_size)
  760. {
  761.     int buffer_size= (bit_size+7)>>3;
           ^
  762.     if(buffer_size < 0 || bit_size < 0) {
  763.         buffer_size = bit_size = 0;

libavcodec/bitstream.h:762:8: Taking true branch
  760. {
  761.     int buffer_size= (bit_size+7)>>3;
  762.     if(buffer_size < 0 || bit_size < 0) {
              ^
  763.         buffer_size = bit_size = 0;
  764.         buffer = NULL;

libavcodec/bitstream.h:763:9: 
  761.     int buffer_size= (bit_size+7)>>3;
  762.     if(buffer_size < 0 || bit_size < 0) {
  763.         buffer_size = bit_size = 0;
               ^
  764.         buffer = NULL;
  765.     }

libavcodec/bitstream.h:764:9: 
  762.     if(buffer_size < 0 || bit_size < 0) {
  763.         buffer_size = bit_size = 0;
  764.         buffer = NULL;
               ^
  765.     }
  766. 

libavcodec/bitstream.h:767:5: 
  765.     }
  766. 
  767.     s->buffer= buffer;
           ^
  768.     s->size_in_bits= bit_size;
  769.     s->buffer_end= buffer + buffer_size;

libavcodec/bitstream.h:768:5: 
  766. 
  767.     s->buffer= buffer;
  768.     s->size_in_bits= bit_size;
           ^
  769.     s->buffer_end= buffer + buffer_size;
  770. #ifdef ALT_BITSTREAM_READER

libavcodec/bitstream.h:769:5: 
  767.     s->buffer= buffer;
  768.     s->size_in_bits= bit_size;
  769.     s->buffer_end= buffer + buffer_size;
           ^
  770. #ifdef ALT_BITSTREAM_READER
  771.     s->index=0;

libavcodec/bitstream.h:771:5: 
  769.     s->buffer_end= buffer + buffer_size;
  770. #ifdef ALT_BITSTREAM_READER
  771.     s->index=0;
           ^
  772. #elif defined LIBMPEG2_BITSTREAM_READER
  773.     s->buffer_ptr = (uint8_t*)((intptr_t)buffer&(~1));

libavcodec/bitstream.h:781:1: return from a call to init_get_bits
  779.     skip_bits_long(s, 0);
  780. #endif
  781. }
       ^
  782. 
  783. static inline void align_get_bits(GetBitContext *s)

libavcodec/smacker.c:286:9: 
284.     init_get_bits(&gb, smk->avctx->extradata + 16, (smk->avctx->extradata_size - 16) * 8);
285. 
286.     if(!get_bits1(&gb)) {
             ^
287.         av_log(smk->avctx, AV_LOG_INFO, "Skipping MMAP tree\n");
288.         smk->mmap_tbl = av_malloc(sizeof(int) * 2);

libavcodec/bitstream.h:686:1: start of procedure get_bits1()
  684. }
  685. 
  686. static inline unsigned int get_bits1(GetBitContext *s){
       ^
  687. #ifdef ALT_BITSTREAM_READER
  688.     int index= s->index;

libavcodec/bitstream.h:688:5: 
  686. static inline unsigned int get_bits1(GetBitContext *s){
  687. #ifdef ALT_BITSTREAM_READER
  688.     int index= s->index;
           ^
  689.     uint8_t result= s->buffer[ index>>3 ];
  690. #ifdef ALT_BITSTREAM_READER_LE

libavcodec/bitstream.h:689:5: 
  687. #ifdef ALT_BITSTREAM_READER
  688.     int index= s->index;
  689.     uint8_t result= s->buffer[ index>>3 ];
           ^
  690. #ifdef ALT_BITSTREAM_READER_LE
  691.     result>>= (index&0x07);

static int decode_header_trees(SmackVContext *smk) {
    GetBitContext gb;
    int mmap_size, mclr_size, full_size, type_size;
    mmap_size = AV_RL32(smk->avctx->extradata);
    mclr_size = AV_RL32(smk->avctx->extradata + 4);
    full_size = AV_RL32(smk->avctx->extradata + 8);
    type_size = AV_RL32(smk->avctx->extradata + 12);
    init_get_bits(&gb, smk->avctx->extradata + 16, (smk->avctx->extradata_size - 16) * 8);
    if(!get_bits1(&gb)) {
        av_log(smk->avctx, AV_LOG_INFO, "Skipping MMAP tree\n");
        smk->mmap_tbl = av_malloc(sizeof(int) * 2);
        smk->mmap_tbl[0] = 0;
        smk->mmap_last[0] = smk->mmap_last[1] = smk->mmap_last[2] = 1;
    } else {
        smacker_decode_header_tree(smk, &gb, &smk->mmap_tbl, smk->mmap_last, mmap_size);
    }
    if(!get_bits1(&gb)) {
        av_log(smk->avctx, AV_LOG_INFO, "Skipping MCLR tree\n");
        smk->mclr_tbl = av_malloc(sizeof(int) * 2);
        smk->mclr_tbl[0] = 0;
        smk->mclr_last[0] = smk->mclr_last[1] = smk->mclr_last[2] = 1;
    } else {
        smacker_decode_header_tree(smk, &gb, &smk->mclr_tbl, smk->mclr_last, mclr_size);
    }
    if(!get_bits1(&gb)) {
        av_log(smk->avctx, AV_LOG_INFO, "Skipping FULL tree\n");
        smk->full_tbl = av_malloc(sizeof(int) * 2);
        smk->full_tbl[0] = 0;
        smk->full_last[0] = smk->full_last[1] = smk->full_last[2] = 1;
    } else {
        smacker_decode_header_tree(smk, &gb, &smk->full_tbl, smk->full_last, full_size);
    }
    if(!get_bits1(&gb)) {
        av_log(smk->avctx, AV_LOG_INFO, "Skipping TYPE tree\n");
        smk->type_tbl = av_malloc(sizeof(int) * 2);
        smk->type_tbl[0] = 0;
        smk->type_last[0] = smk->type_last[1] = smk->type_last[2] = 1;
    } else {
        smacker_decode_header_tree(smk, &gb, &smk->type_tbl, smk->type_last, type_size);
    }
    return 0;
}
['static int decode_header_trees(SmackVContext *smk) {\n    GetBitContext gb;\n    int mmap_size, mclr_size, full_size, type_size;\n    mmap_size = AV_RL32(smk->avctx->extradata);\n    mclr_size = AV_RL32(smk->avctx->extradata + 4);\n    full_size = AV_RL32(smk->avctx->extradata + 8);\n    type_size = AV_RL32(smk->avctx->extradata + 12);\n    init_get_bits(&gb, smk->avctx->extradata + 16, (smk->avctx->extradata_size - 16) * 8);\n    if(!get_bits1(&gb)) {\n        av_log(smk->avctx, AV_LOG_INFO, "Skipping MMAP tree\\n");\n        smk->mmap_tbl = av_malloc(sizeof(int) * 2);\n        smk->mmap_tbl[0] = 0;\n        smk->mmap_last[0] = smk->mmap_last[1] = smk->mmap_last[2] = 1;\n    } else {\n        smacker_decode_header_tree(smk, &gb, &smk->mmap_tbl, smk->mmap_last, mmap_size);\n    }\n    if(!get_bits1(&gb)) {\n        av_log(smk->avctx, AV_LOG_INFO, "Skipping MCLR tree\\n");\n        smk->mclr_tbl = av_malloc(sizeof(int) * 2);\n        smk->mclr_tbl[0] = 0;\n        smk->mclr_last[0] = smk->mclr_last[1] = smk->mclr_last[2] = 1;\n    } else {\n        smacker_decode_header_tree(smk, &gb, &smk->mclr_tbl, smk->mclr_last, mclr_size);\n    }\n    if(!get_bits1(&gb)) {\n        av_log(smk->avctx, AV_LOG_INFO, "Skipping FULL tree\\n");\n        smk->full_tbl = av_malloc(sizeof(int) * 2);\n        smk->full_tbl[0] = 0;\n        smk->full_last[0] = smk->full_last[1] = smk->full_last[2] = 1;\n    } else {\n        smacker_decode_header_tree(smk, &gb, &smk->full_tbl, smk->full_last, full_size);\n    }\n    if(!get_bits1(&gb)) {\n        av_log(smk->avctx, AV_LOG_INFO, "Skipping TYPE tree\\n");\n        smk->type_tbl = av_malloc(sizeof(int) * 2);\n        smk->type_tbl[0] = 0;\n        smk->type_last[0] = smk->type_last[1] = smk->type_last[2] = 1;\n    } else {\n        smacker_decode_header_tree(smk, &gb, &smk->type_tbl, smk->type_last, type_size);\n    }\n    return 0;\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}']