libavcodec/truemotion2.c:152: error: Null Dereference
  pointer `&huff->bits` last assigned on line 149 could be null and is dereferenced by call to `tm2_read_tree()` at line 152, column 8.

libavcodec/truemotion2.c:120:1: start of procedure tm2_build_huff_table()
118. }
119. 
120. static int tm2_build_huff_table(TM2Context *ctx, TM2Codes *code)
     ^
121. {
122.     TM2Huff huff;

libavcodec/truemotion2.c:123:5: 
121. {
122.     TM2Huff huff;
123.     int res = 0;
         ^
124. 
125.     huff.val_bits = get_bits(&ctx->gb, 5);

libavcodec/truemotion2.c:125:5: 
123.     int res = 0;
124. 
125.     huff.val_bits = get_bits(&ctx->gb, 5);
         ^
126.     huff.max_bits = get_bits(&ctx->gb, 5);
127.     huff.min_bits = get_bits(&ctx->gb, 5);

libavcodec/get_bits.h:237:1: start of procedure get_bits()
  235.  * Read 1-25 bits.
  236.  */
  237. static inline unsigned int get_bits(GetBitContext *s, int n)
       ^
  238. {
  239.     register int tmp;

libavcodec/get_bits.h:240:5: 
  238. {
  239.     register int tmp;
  240.     OPEN_READER(re, s);
           ^
  241.     UPDATE_CACHE(re, s);
  242.     tmp = SHOW_UBITS(re, s, n);

libavcodec/get_bits.h:241:5: 
  239.     register int tmp;
  240.     OPEN_READER(re, s);
  241.     UPDATE_CACHE(re, s);
           ^
  242.     tmp = SHOW_UBITS(re, s, n);
  243.     LAST_SKIP_BITS(re, s, n);

libavutil/bswap.h:66:1: start of procedure av_bswap32()
    64. 
    65. #ifndef av_bswap32
    66. static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
        ^
    67. {
    68.     return AV_BSWAP32C(x);

libavutil/bswap.h:68:5: 
    66. static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
    67. {
    68.     return AV_BSWAP32C(x);
            ^
    69. }
    70. #endif

libavutil/bswap.h:69:1: return from a call to av_bswap32
    67. {
    68.     return AV_BSWAP32C(x);
    69. }
        ^
    70. #endif
    71. 

libavcodec/get_bits.h:242:5: 
  240.     OPEN_READER(re, s);
  241.     UPDATE_CACHE(re, s);
  242.     tmp = SHOW_UBITS(re, s, n);
           ^
  243.     LAST_SKIP_BITS(re, s, n);
  244.     CLOSE_READER(re, s);

libavcodec/get_bits.h:243:5: Condition is true
  241.     UPDATE_CACHE(re, s);
  242.     tmp = SHOW_UBITS(re, s, n);
  243.     LAST_SKIP_BITS(re, s, n);
           ^
  244.     CLOSE_READER(re, s);
  245.     return tmp;

libavcodec/get_bits.h:244:5: 
  242.     tmp = SHOW_UBITS(re, s, n);
  243.     LAST_SKIP_BITS(re, s, n);
  244.     CLOSE_READER(re, s);
           ^
  245.     return tmp;
  246. }

libavcodec/get_bits.h:245:5: 
  243.     LAST_SKIP_BITS(re, s, n);
  244.     CLOSE_READER(re, s);
  245.     return tmp;
           ^
  246. }
  247. 

libavcodec/get_bits.h:246:1: return from a call to get_bits
  244.     CLOSE_READER(re, s);
  245.     return tmp;
  246. }
       ^
  247. 
  248. /**

libavcodec/truemotion2.c:126:5: 
124. 
125.     huff.val_bits = get_bits(&ctx->gb, 5);
126.     huff.max_bits = get_bits(&ctx->gb, 5);
         ^
127.     huff.min_bits = get_bits(&ctx->gb, 5);
128.     huff.nodes = get_bits_long(&ctx->gb, 17);

libavcodec/get_bits.h:237:1: start of procedure get_bits()
  235.  * Read 1-25 bits.
  236.  */
  237. static inline unsigned int get_bits(GetBitContext *s, int n)
       ^
  238. {
  239.     register int tmp;

libavcodec/get_bits.h:240:5: 
  238. {
  239.     register int tmp;
  240.     OPEN_READER(re, s);
           ^
  241.     UPDATE_CACHE(re, s);
  242.     tmp = SHOW_UBITS(re, s, n);

libavcodec/get_bits.h:241:5: 
  239.     register int tmp;
  240.     OPEN_READER(re, s);
  241.     UPDATE_CACHE(re, s);
           ^
  242.     tmp = SHOW_UBITS(re, s, n);
  243.     LAST_SKIP_BITS(re, s, n);

libavutil/bswap.h:66:1: start of procedure av_bswap32()
    64. 
    65. #ifndef av_bswap32
    66. static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
        ^
    67. {
    68.     return AV_BSWAP32C(x);

libavutil/bswap.h:68:5: 
    66. static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
    67. {
    68.     return AV_BSWAP32C(x);
            ^
    69. }
    70. #endif

libavutil/bswap.h:69:1: return from a call to av_bswap32
    67. {
    68.     return AV_BSWAP32C(x);
    69. }
        ^
    70. #endif
    71. 

libavcodec/get_bits.h:242:5: 
  240.     OPEN_READER(re, s);
  241.     UPDATE_CACHE(re, s);
  242.     tmp = SHOW_UBITS(re, s, n);
           ^
  243.     LAST_SKIP_BITS(re, s, n);
  244.     CLOSE_READER(re, s);

libavcodec/get_bits.h:243:5: Condition is true
  241.     UPDATE_CACHE(re, s);
  242.     tmp = SHOW_UBITS(re, s, n);
  243.     LAST_SKIP_BITS(re, s, n);
           ^
  244.     CLOSE_READER(re, s);
  245.     return tmp;

libavcodec/get_bits.h:244:5: 
  242.     tmp = SHOW_UBITS(re, s, n);
  243.     LAST_SKIP_BITS(re, s, n);
  244.     CLOSE_READER(re, s);
           ^
  245.     return tmp;
  246. }

libavcodec/get_bits.h:245:5: 
  243.     LAST_SKIP_BITS(re, s, n);
  244.     CLOSE_READER(re, s);
  245.     return tmp;
           ^
  246. }
  247. 

libavcodec/get_bits.h:246:1: return from a call to get_bits
  244.     CLOSE_READER(re, s);
  245.     return tmp;
  246. }
       ^
  247. 
  248. /**

libavcodec/truemotion2.c:127:5: 
125.     huff.val_bits = get_bits(&ctx->gb, 5);
126.     huff.max_bits = get_bits(&ctx->gb, 5);
127.     huff.min_bits = get_bits(&ctx->gb, 5);
         ^
128.     huff.nodes = get_bits_long(&ctx->gb, 17);
129.     huff.num = 0;

libavcodec/get_bits.h:237:1: start of procedure get_bits()
  235.  * Read 1-25 bits.
  236.  */
  237. static inline unsigned int get_bits(GetBitContext *s, int n)
       ^
  238. {
  239.     register int tmp;

libavcodec/get_bits.h:240:5: 
  238. {
  239.     register int tmp;
  240.     OPEN_READER(re, s);
           ^
  241.     UPDATE_CACHE(re, s);
  242.     tmp = SHOW_UBITS(re, s, n);

libavcodec/get_bits.h:241:5: 
  239.     register int tmp;
  240.     OPEN_READER(re, s);
  241.     UPDATE_CACHE(re, s);
           ^
  242.     tmp = SHOW_UBITS(re, s, n);
  243.     LAST_SKIP_BITS(re, s, n);

libavutil/bswap.h:66:1: start of procedure av_bswap32()
    64. 
    65. #ifndef av_bswap32
    66. static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
        ^
    67. {
    68.     return AV_BSWAP32C(x);

libavutil/bswap.h:68:5: 
    66. static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
    67. {
    68.     return AV_BSWAP32C(x);
            ^
    69. }
    70. #endif

libavutil/bswap.h:69:1: return from a call to av_bswap32
    67. {
    68.     return AV_BSWAP32C(x);
    69. }
        ^
    70. #endif
    71. 

libavcodec/get_bits.h:242:5: 
  240.     OPEN_READER(re, s);
  241.     UPDATE_CACHE(re, s);
  242.     tmp = SHOW_UBITS(re, s, n);
           ^
  243.     LAST_SKIP_BITS(re, s, n);
  244.     CLOSE_READER(re, s);

libavcodec/get_bits.h:243:5: Condition is true
  241.     UPDATE_CACHE(re, s);
  242.     tmp = SHOW_UBITS(re, s, n);
  243.     LAST_SKIP_BITS(re, s, n);
           ^
  244.     CLOSE_READER(re, s);
  245.     return tmp;

libavcodec/get_bits.h:244:5: 
  242.     tmp = SHOW_UBITS(re, s, n);
  243.     LAST_SKIP_BITS(re, s, n);
  244.     CLOSE_READER(re, s);
           ^
  245.     return tmp;
  246. }

libavcodec/get_bits.h:245:5: 
  243.     LAST_SKIP_BITS(re, s, n);
  244.     CLOSE_READER(re, s);
  245.     return tmp;
           ^
  246. }
  247. 

libavcodec/get_bits.h:246:1: return from a call to get_bits
  244.     CLOSE_READER(re, s);
  245.     return tmp;
  246. }
       ^
  247. 
  248. /**

libavcodec/truemotion2.c:128:5: 
126.     huff.max_bits = get_bits(&ctx->gb, 5);
127.     huff.min_bits = get_bits(&ctx->gb, 5);
128.     huff.nodes = get_bits_long(&ctx->gb, 17);
         ^
129.     huff.num = 0;
130. 

libavcodec/get_bits.h:301:1: start of procedure get_bits_long()
  299.  * Read 0-32 bits.
  300.  */
  301. static inline unsigned int get_bits_long(GetBitContext *s, int n)
       ^
  302. {
  303.     if (n <= MIN_CACHE_BITS)

libavcodec/get_bits.h:303:9: Taking true branch
  301. static inline unsigned int get_bits_long(GetBitContext *s, int n)
  302. {
  303.     if (n <= MIN_CACHE_BITS)
               ^
  304.         return get_bits(s, n);
  305.     else {

libavcodec/get_bits.h:304:9: 
  302. {
  303.     if (n <= MIN_CACHE_BITS)
  304.         return get_bits(s, n);
               ^
  305.     else {
  306. #ifdef BITSTREAM_READER_LE

libavcodec/get_bits.h:237:1: start of procedure get_bits()
    235.  * Read 1-25 bits.
    236.  */
    237. static inline unsigned int get_bits(GetBitContext *s, int n)
         ^
    238. {
    239.     register int tmp;

libavcodec/get_bits.h:240:5: 
    238. {
    239.     register int tmp;
    240.     OPEN_READER(re, s);
             ^
    241.     UPDATE_CACHE(re, s);
    242.     tmp = SHOW_UBITS(re, s, n);

libavcodec/get_bits.h:241:5: 
    239.     register int tmp;
    240.     OPEN_READER(re, s);
    241.     UPDATE_CACHE(re, s);
             ^
    242.     tmp = SHOW_UBITS(re, s, n);
    243.     LAST_SKIP_BITS(re, s, n);

libavutil/bswap.h:66:1: start of procedure av_bswap32()
      64. 
      65. #ifndef av_bswap32
      66. static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
          ^
      67. {
      68.     return AV_BSWAP32C(x);

libavutil/bswap.h:68:5: 
      66. static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
      67. {
      68.     return AV_BSWAP32C(x);
              ^
      69. }
      70. #endif

libavutil/bswap.h:69:1: return from a call to av_bswap32
      67. {
      68.     return AV_BSWAP32C(x);
      69. }
          ^
      70. #endif
      71. 

libavcodec/get_bits.h:242:5: 
    240.     OPEN_READER(re, s);
    241.     UPDATE_CACHE(re, s);
    242.     tmp = SHOW_UBITS(re, s, n);
             ^
    243.     LAST_SKIP_BITS(re, s, n);
    244.     CLOSE_READER(re, s);

libavcodec/get_bits.h:243:5: Condition is false
    241.     UPDATE_CACHE(re, s);
    242.     tmp = SHOW_UBITS(re, s, n);
    243.     LAST_SKIP_BITS(re, s, n);
             ^
    244.     CLOSE_READER(re, s);
    245.     return tmp;

libavcodec/get_bits.h:244:5: 
    242.     tmp = SHOW_UBITS(re, s, n);
    243.     LAST_SKIP_BITS(re, s, n);
    244.     CLOSE_READER(re, s);
             ^
    245.     return tmp;
    246. }

libavcodec/get_bits.h:245:5: 
    243.     LAST_SKIP_BITS(re, s, n);
    244.     CLOSE_READER(re, s);
    245.     return tmp;
             ^
    246. }
    247. 

libavcodec/get_bits.h:246:1: return from a call to get_bits
    244.     CLOSE_READER(re, s);
    245.     return tmp;
    246. }
         ^
    247. 
    248. /**

libavcodec/get_bits.h:314:1: return from a call to get_bits_long
  312. #endif
  313.     }
  314. }
       ^
  315. 
  316. /**

libavcodec/truemotion2.c:129:5: 
127.     huff.min_bits = get_bits(&ctx->gb, 5);
128.     huff.nodes = get_bits_long(&ctx->gb, 17);
129.     huff.num = 0;
         ^
130. 
131.     /* check for correct codes parameters */

libavcodec/truemotion2.c:132:9: Taking false branch
130. 
131.     /* check for correct codes parameters */
132.     if((huff.val_bits < 1) || (huff.val_bits > 32) ||
             ^
133.        (huff.max_bits < 0) || (huff.max_bits > 25)) {
134.         av_log(ctx->avctx, AV_LOG_ERROR, "Incorrect tree parameters - literal length: %i, max code length: %i\n",

libavcodec/truemotion2.c:132:32: Taking false branch
130. 
131.     /* check for correct codes parameters */
132.     if((huff.val_bits < 1) || (huff.val_bits > 32) ||
                                    ^
133.        (huff.max_bits < 0) || (huff.max_bits > 25)) {
134.         av_log(ctx->avctx, AV_LOG_ERROR, "Incorrect tree parameters - literal length: %i, max code length: %i\n",

libavcodec/truemotion2.c:133:9: Taking false branch
131.     /* check for correct codes parameters */
132.     if((huff.val_bits < 1) || (huff.val_bits > 32) ||
133.        (huff.max_bits < 0) || (huff.max_bits > 25)) {
             ^
134.         av_log(ctx->avctx, AV_LOG_ERROR, "Incorrect tree parameters - literal length: %i, max code length: %i\n",
135.                huff.val_bits, huff.max_bits);

libavcodec/truemotion2.c:133:32: Taking false branch
131.     /* check for correct codes parameters */
132.     if((huff.val_bits < 1) || (huff.val_bits > 32) ||
133.        (huff.max_bits < 0) || (huff.max_bits > 25)) {
                                    ^
134.         av_log(ctx->avctx, AV_LOG_ERROR, "Incorrect tree parameters - literal length: %i, max code length: %i\n",
135.                huff.val_bits, huff.max_bits);

libavcodec/truemotion2.c:138:9: Taking false branch
136.         return -1;
137.     }
138.     if((huff.nodes <= 0) || (huff.nodes > 0x10000)) {
             ^
139.         av_log(ctx->avctx, AV_LOG_ERROR, "Incorrect number of Huffman tree nodes: %i\n", huff.nodes);
140.         return -1;

libavcodec/truemotion2.c:138:30: Taking false branch
136.         return -1;
137.     }
138.     if((huff.nodes <= 0) || (huff.nodes > 0x10000)) {
                                  ^
139.         av_log(ctx->avctx, AV_LOG_ERROR, "Incorrect number of Huffman tree nodes: %i\n", huff.nodes);
140.         return -1;

libavcodec/truemotion2.c:143:8: Taking false branch
141.     }
142.     /* one-node tree */
143.     if(huff.max_bits == 0)
            ^
144.         huff.max_bits = 1;
145. 

libavcodec/truemotion2.c:147:5: 
145. 
146.     /* allocate space for codes - it is exactly ceil(nodes / 2) entries */
147.     huff.max_num = (huff.nodes + 1) >> 1;
         ^
148.     huff.nums = av_mallocz(huff.max_num * sizeof(int));
149.     huff.bits = av_mallocz(huff.max_num * sizeof(uint32_t));

libavcodec/truemotion2.c:148:5: 
146.     /* allocate space for codes - it is exactly ceil(nodes / 2) entries */
147.     huff.max_num = (huff.nodes + 1) >> 1;
148.     huff.nums = av_mallocz(huff.max_num * sizeof(int));
         ^
149.     huff.bits = av_mallocz(huff.max_num * sizeof(uint32_t));
150.     huff.lens = av_mallocz(huff.max_num * sizeof(int));

libavutil/mem.c:161:1: start of procedure av_mallocz()
  159. }
  160. 
  161. void *av_mallocz(size_t size)
       ^
  162. {
  163.     void *ptr = av_malloc(size);

libavutil/mem.c:163:5: 
  161. void *av_mallocz(size_t size)
  162. {
  163.     void *ptr = av_malloc(size);
           ^
  164.     if (ptr)
  165.         memset(ptr, 0, size);

libavutil/mem.c:64:1: start of procedure av_malloc()
    62.  * linker will do it automatically. */
    63. 
    64. void *av_malloc(size_t size)
        ^
    65. {
    66.     void *ptr = NULL;

libavutil/mem.c:66:5: 
    64. void *av_malloc(size_t size)
    65. {
    66.     void *ptr = NULL;
            ^
    67. #if CONFIG_MEMALIGN_HACK
    68.     long diff;

libavutil/mem.c:72:9: Taking true branch
    70. 
    71.     /* let's disallow possible ambiguous cases */
    72.     if (size > (INT_MAX - 32) || !size)
                ^
    73.         return NULL;
    74. 

libavutil/mem.c:73:9: 
    71.     /* let's disallow possible ambiguous cases */
    72.     if (size > (INT_MAX - 32) || !size)
    73.         return NULL;
                ^
    74. 
    75. #if CONFIG_MEMALIGN_HACK

libavutil/mem.c:117:1: return from a call to av_malloc
    115. #endif
    116.     return ptr;
    117. }
         ^
    118. 
    119. void *av_realloc(void *ptr, size_t size)

libavutil/mem.c:164:9: Taking false branch
  162. {
  163.     void *ptr = av_malloc(size);
  164.     if (ptr)
               ^
  165.         memset(ptr, 0, size);
  166.     return ptr;

libavutil/mem.c:166:5: 
  164.     if (ptr)
  165.         memset(ptr, 0, size);
  166.     return ptr;
           ^
  167. }
  168. 

libavutil/mem.c:167:1: return from a call to av_mallocz
  165.         memset(ptr, 0, size);
  166.     return ptr;
  167. }
       ^
  168. 
  169. char *av_strdup(const char *s)

libavcodec/truemotion2.c:149:5: 
147.     huff.max_num = (huff.nodes + 1) >> 1;
148.     huff.nums = av_mallocz(huff.max_num * sizeof(int));
149.     huff.bits = av_mallocz(huff.max_num * sizeof(uint32_t));
         ^
150.     huff.lens = av_mallocz(huff.max_num * sizeof(int));
151. 

libavutil/mem.c:161:1: start of procedure av_mallocz()
  159. }
  160. 
  161. void *av_mallocz(size_t size)
       ^
  162. {
  163.     void *ptr = av_malloc(size);

libavutil/mem.c:163:5: 
  161. void *av_mallocz(size_t size)
  162. {
  163.     void *ptr = av_malloc(size);
           ^
  164.     if (ptr)
  165.         memset(ptr, 0, size);

libavutil/mem.c:64:1: start of procedure av_malloc()
    62.  * linker will do it automatically. */
    63. 
    64. void *av_malloc(size_t size)
        ^
    65. {
    66.     void *ptr = NULL;

libavutil/mem.c:66:5: 
    64. void *av_malloc(size_t size)
    65. {
    66.     void *ptr = NULL;
            ^
    67. #if CONFIG_MEMALIGN_HACK
    68.     long diff;

libavutil/mem.c:72:9: Taking true branch
    70. 
    71.     /* let's disallow possible ambiguous cases */
    72.     if (size > (INT_MAX - 32) || !size)
                ^
    73.         return NULL;
    74. 

libavutil/mem.c:73:9: 
    71.     /* let's disallow possible ambiguous cases */
    72.     if (size > (INT_MAX - 32) || !size)
    73.         return NULL;
                ^
    74. 
    75. #if CONFIG_MEMALIGN_HACK

libavutil/mem.c:117:1: return from a call to av_malloc
    115. #endif
    116.     return ptr;
    117. }
         ^
    118. 
    119. void *av_realloc(void *ptr, size_t size)

libavutil/mem.c:164:9: Taking false branch
  162. {
  163.     void *ptr = av_malloc(size);
  164.     if (ptr)
               ^
  165.         memset(ptr, 0, size);
  166.     return ptr;

libavutil/mem.c:166:5: 
  164.     if (ptr)
  165.         memset(ptr, 0, size);
  166.     return ptr;
           ^
  167. }
  168. 

libavutil/mem.c:167:1: return from a call to av_mallocz
  165.         memset(ptr, 0, size);
  166.     return ptr;
  167. }
       ^
  168. 
  169. char *av_strdup(const char *s)

libavcodec/truemotion2.c:150:5: 
148.     huff.nums = av_mallocz(huff.max_num * sizeof(int));
149.     huff.bits = av_mallocz(huff.max_num * sizeof(uint32_t));
150.     huff.lens = av_mallocz(huff.max_num * sizeof(int));
         ^
151. 
152.     if(tm2_read_tree(ctx, 0, 0, &huff) == -1)

libavutil/mem.c:161:1: start of procedure av_mallocz()
  159. }
  160. 
  161. void *av_mallocz(size_t size)
       ^
  162. {
  163.     void *ptr = av_malloc(size);

libavutil/mem.c:163:5: 
  161. void *av_mallocz(size_t size)
  162. {
  163.     void *ptr = av_malloc(size);
           ^
  164.     if (ptr)
  165.         memset(ptr, 0, size);

libavutil/mem.c:64:1: start of procedure av_malloc()
    62.  * linker will do it automatically. */
    63. 
    64. void *av_malloc(size_t size)
        ^
    65. {
    66.     void *ptr = NULL;

libavutil/mem.c:66:5: 
    64. void *av_malloc(size_t size)
    65. {
    66.     void *ptr = NULL;
            ^
    67. #if CONFIG_MEMALIGN_HACK
    68.     long diff;

libavutil/mem.c:72:9: Taking true branch
    70. 
    71.     /* let's disallow possible ambiguous cases */
    72.     if (size > (INT_MAX - 32) || !size)
                ^
    73.         return NULL;
    74. 

libavutil/mem.c:73:9: 
    71.     /* let's disallow possible ambiguous cases */
    72.     if (size > (INT_MAX - 32) || !size)
    73.         return NULL;
                ^
    74. 
    75. #if CONFIG_MEMALIGN_HACK

libavutil/mem.c:117:1: return from a call to av_malloc
    115. #endif
    116.     return ptr;
    117. }
         ^
    118. 
    119. void *av_realloc(void *ptr, size_t size)

libavutil/mem.c:164:9: Taking false branch
  162. {
  163.     void *ptr = av_malloc(size);
  164.     if (ptr)
               ^
  165.         memset(ptr, 0, size);
  166.     return ptr;

libavutil/mem.c:166:5: 
  164.     if (ptr)
  165.         memset(ptr, 0, size);
  166.     return ptr;
           ^
  167. }
  168. 

libavutil/mem.c:167:1: return from a call to av_mallocz
  165.         memset(ptr, 0, size);
  166.     return ptr;
  167. }
       ^
  168. 
  169. char *av_strdup(const char *s)

libavcodec/truemotion2.c:152:8: 
150.     huff.lens = av_mallocz(huff.max_num * sizeof(int));
151. 
152.     if(tm2_read_tree(ctx, 0, 0, &huff) == -1)
            ^
153.         res = -1;
154. 

libavcodec/truemotion2.c:91:1: start of procedure tm2_read_tree()
  89. } TM2Huff;
  90. 
  91. static int tm2_read_tree(TM2Context *ctx, uint32_t prefix, int length, TM2Huff *huff)
      ^
  92. {
  93.     if(length > huff->max_bits) {

libavcodec/truemotion2.c:93:8: Taking false branch
  91. static int tm2_read_tree(TM2Context *ctx, uint32_t prefix, int length, TM2Huff *huff)
  92. {
  93.     if(length > huff->max_bits) {
             ^
  94.         av_log(ctx->avctx, AV_LOG_ERROR, "Tree exceeded its given depth (%i)\n", huff->max_bits);
  95.         return -1;

libavcodec/truemotion2.c:98:9: 
   96.     }
   97. 
   98.     if(!get_bits1(&ctx->gb)) { /* literal */
               ^
   99.         if (length == 0) {
  100.             length = 1;

libavcodec/get_bits.h:268:1: start of procedure get_bits1()
    266. }
    267. 
    268. static inline unsigned int get_bits1(GetBitContext *s)
         ^
    269. {
    270.     unsigned int index = s->index;

libavcodec/get_bits.h:270:5: 
    268. static inline unsigned int get_bits1(GetBitContext *s)
    269. {
    270.     unsigned int index = s->index;
             ^
    271.     uint8_t result = s->buffer[index>>3];
    272. #ifdef BITSTREAM_READER_LE

libavcodec/get_bits.h:271:5: 
    269. {
    270.     unsigned int index = s->index;
    271.     uint8_t result = s->buffer[index>>3];
             ^
    272. #ifdef BITSTREAM_READER_LE
    273.     result >>= index & 7;

libavcodec/get_bits.h:273:5: 
    271.     uint8_t result = s->buffer[index>>3];
    272. #ifdef BITSTREAM_READER_LE
    273.     result >>= index & 7;
             ^
    274.     result &= 1;
    275. #else

libavcodec/get_bits.h:274:5: 
    272. #ifdef BITSTREAM_READER_LE
    273.     result >>= index & 7;
    274.     result &= 1;
             ^
    275. #else
    276.     result <<= index & 7;

libavcodec/get_bits.h:280:9: Taking true branch
    278. #endif
    279. #if !UNCHECKED_BITSTREAM_READER
    280.     if (s->index < s->size_in_bits_plus8)
                 ^
    281. #endif
    282.         index++;

libavcodec/get_bits.h:282:9: 
    280.     if (s->index < s->size_in_bits_plus8)
    281. #endif
    282.         index++;
                 ^
    283.     s->index = index;
    284. 

libavcodec/get_bits.h:283:5: 
    281. #endif
    282.         index++;
    283.     s->index = index;
             ^
    284. 
    285.     return result;

libavcodec/get_bits.h:285:5: 
    283.     s->index = index;
    284. 
    285.     return result;
             ^
    286. }
    287. 

libavcodec/get_bits.h:286:1: return from a call to get_bits1
    284. 
    285.     return result;
    286. }
         ^
    287. 
    288. static inline unsigned int show_bits1(GetBitContext *s)

libavcodec/truemotion2.c:98:9: Taking false branch
   96.     }
   97. 
   98.     if(!get_bits1(&ctx->gb)) { /* literal */
               ^
   99.         if (length == 0) {
  100.             length = 1;

libavcodec/truemotion2.c:112:12: Taking true branch
  110.         return 0;
  111.     } else { /* non-terminal node */
  112.         if(tm2_read_tree(ctx, prefix << 1, length + 1, huff) == -1)
                  ^
  113.             return -1;
  114.         if(tm2_read_tree(ctx, (prefix << 1) | 1, length + 1, huff) == -1)

libavcodec/truemotion2.c:113:13: 
  111.     } else { /* non-terminal node */
  112.         if(tm2_read_tree(ctx, prefix << 1, length + 1, huff) == -1)
  113.             return -1;
                   ^
  114.         if(tm2_read_tree(ctx, (prefix << 1) | 1, length + 1, huff) == -1)
  115.             return -1;

libavcodec/truemotion2.c:118:1: return from a call to tm2_read_tree
  116.     }
  117.     return 0;
  118. }
       ^
  119. 
  120. static int tm2_build_huff_table(TM2Context *ctx, TM2Codes *code)

static int tm2_build_huff_table(TM2Context *ctx, TM2Codes *code)
{
    TM2Huff huff;
    int res = 0;
    huff.val_bits = get_bits(&ctx->gb, 5);
    huff.max_bits = get_bits(&ctx->gb, 5);
    huff.min_bits = get_bits(&ctx->gb, 5);
    huff.nodes = get_bits_long(&ctx->gb, 17);
    huff.num = 0;
    if((huff.val_bits < 1) || (huff.val_bits > 32) ||
       (huff.max_bits < 0) || (huff.max_bits > 25)) {
        av_log(ctx->avctx, AV_LOG_ERROR, "Incorrect tree parameters - literal length: %i, max code length: %i\n",
               huff.val_bits, huff.max_bits);
        return -1;
    }
    if((huff.nodes <= 0) || (huff.nodes > 0x10000)) {
        av_log(ctx->avctx, AV_LOG_ERROR, "Incorrect number of Huffman tree nodes: %i\n", huff.nodes);
        return -1;
    }
    if(huff.max_bits == 0)
        huff.max_bits = 1;
    huff.max_num = (huff.nodes + 1) >> 1;
    huff.nums = av_mallocz(huff.max_num * sizeof(int));
    huff.bits = av_mallocz(huff.max_num * sizeof(uint32_t));
    huff.lens = av_mallocz(huff.max_num * sizeof(int));
    if(tm2_read_tree(ctx, 0, 0, &huff) == -1)
        res = -1;
    if(huff.num != huff.max_num) {
        av_log(ctx->avctx, AV_LOG_ERROR, "Got less codes than expected: %i of %i\n",
               huff.num, huff.max_num);
        res = -1;
    }
    if(res != -1) {
        int i;
        res = init_vlc(&code->vlc, huff.max_bits, huff.max_num,
                    huff.lens, sizeof(int), sizeof(int),
                    huff.bits, sizeof(uint32_t), sizeof(uint32_t), 0);
        if(res < 0) {
            av_log(ctx->avctx, AV_LOG_ERROR, "Cannot build VLC table\n");
            res = -1;
        } else
            res = 0;
        if(res != -1) {
            code->bits = huff.max_bits;
            code->length = huff.max_num;
            code->recode = av_malloc(code->length * sizeof(int));
            for(i = 0; i < code->length; i++)
                code->recode[i] = huff.nums[i];
        }
    }
    av_free(huff.nums);
    av_free(huff.bits);
    av_free(huff.lens);
    return res;
}
['static int tm2_build_huff_table(TM2Context *ctx, TM2Codes *code)\n{\n    TM2Huff huff;\n    int res = 0;\n    huff.val_bits = get_bits(&ctx->gb, 5);\n    huff.max_bits = get_bits(&ctx->gb, 5);\n    huff.min_bits = get_bits(&ctx->gb, 5);\n    huff.nodes = get_bits_long(&ctx->gb, 17);\n    huff.num = 0;\n    if((huff.val_bits < 1) || (huff.val_bits > 32) ||\n       (huff.max_bits < 0) || (huff.max_bits > 25)) {\n        av_log(ctx->avctx, AV_LOG_ERROR, "Incorrect tree parameters - literal length: %i, max code length: %i\\n",\n               huff.val_bits, huff.max_bits);\n        return -1;\n    }\n    if((huff.nodes <= 0) || (huff.nodes > 0x10000)) {\n        av_log(ctx->avctx, AV_LOG_ERROR, "Incorrect number of Huffman tree nodes: %i\\n", huff.nodes);\n        return -1;\n    }\n    if(huff.max_bits == 0)\n        huff.max_bits = 1;\n    huff.max_num = (huff.nodes + 1) >> 1;\n    huff.nums = av_mallocz(huff.max_num * sizeof(int));\n    huff.bits = av_mallocz(huff.max_num * sizeof(uint32_t));\n    huff.lens = av_mallocz(huff.max_num * sizeof(int));\n    if(tm2_read_tree(ctx, 0, 0, &huff) == -1)\n        res = -1;\n    if(huff.num != huff.max_num) {\n        av_log(ctx->avctx, AV_LOG_ERROR, "Got less codes than expected: %i of %i\\n",\n               huff.num, huff.max_num);\n        res = -1;\n    }\n    if(res != -1) {\n        int i;\n        res = init_vlc(&code->vlc, huff.max_bits, huff.max_num,\n                    huff.lens, sizeof(int), sizeof(int),\n                    huff.bits, sizeof(uint32_t), sizeof(uint32_t), 0);\n        if(res < 0) {\n            av_log(ctx->avctx, AV_LOG_ERROR, "Cannot build VLC table\\n");\n            res = -1;\n        } else\n            res = 0;\n        if(res != -1) {\n            code->bits = huff.max_bits;\n            code->length = huff.max_num;\n            code->recode = av_malloc(code->length * sizeof(int));\n            for(i = 0; i < code->length; i++)\n                code->recode[i] = huff.nums[i];\n        }\n    }\n    av_free(huff.nums);\n    av_free(huff.bits);\n    av_free(huff.lens);\n    return res;\n}', 'static inline unsigned int get_bits(GetBitContext *s, int n)\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}', 'static av_always_inline av_const uint32_t av_bswap32(uint32_t x)\n{\n    return AV_BSWAP32C(x);\n}', 'static inline unsigned int get_bits_long(GetBitContext *s, int n)\n{\n    if (n <= MIN_CACHE_BITS)\n        return get_bits(s, n);\n    else {\n#ifdef BITSTREAM_READER_LE\n        int ret = get_bits(s, 16);\n        return ret | (get_bits(s, n-16) << 16);\n#else\n        int ret = get_bits(s, 16) << (n-16);\n        return ret | get_bits(s, n-16);\n#endif\n    }\n}', 'void *av_mallocz(size_t size)\n{\n    void *ptr = av_malloc(size);\n    if (ptr)\n        memset(ptr, 0, size);\n    return ptr;\n}', 'void *av_malloc(size_t size)\n{\n    void *ptr = NULL;\n#if CONFIG_MEMALIGN_HACK\n    long diff;\n#endif\n    if (size > (INT_MAX - 32) || !size)\n        return NULL;\n#if CONFIG_MEMALIGN_HACK\n    ptr = malloc(size + 32);\n    if (!ptr)\n        return ptr;\n    diff              = ((-(long)ptr - 1) & 31) + 1;\n    ptr               = (char *)ptr + diff;\n    ((char *)ptr)[-1] = diff;\n#elif HAVE_POSIX_MEMALIGN\n    if (posix_memalign(&ptr, 32, size))\n        ptr = NULL;\n#elif HAVE_ALIGNED_MALLOC\n    ptr = _aligned_malloc(size, 32);\n#elif HAVE_MEMALIGN\n    ptr = memalign(32, size);\n#else\n    ptr = malloc(size);\n#endif\n    return ptr;\n}', 'static int tm2_read_tree(TM2Context *ctx, uint32_t prefix, int length, TM2Huff *huff)\n{\n    if(length > huff->max_bits) {\n        av_log(ctx->avctx, AV_LOG_ERROR, "Tree exceeded its given depth (%i)\\n", huff->max_bits);\n        return -1;\n    }\n    if(!get_bits1(&ctx->gb)) {\n        if (length == 0) {\n            length = 1;\n        }\n        if(huff->num >= huff->max_num) {\n            av_log(ctx->avctx, AV_LOG_DEBUG, "Too many literals\\n");\n            return -1;\n        }\n        huff->nums[huff->num] = get_bits_long(&ctx->gb, huff->val_bits);\n        huff->bits[huff->num] = prefix;\n        huff->lens[huff->num] = length;\n        huff->num++;\n        return 0;\n    } else {\n        if(tm2_read_tree(ctx, prefix << 1, length + 1, huff) == -1)\n            return -1;\n        if(tm2_read_tree(ctx, (prefix << 1) | 1, length + 1, huff) == -1)\n            return -1;\n    }\n    return 0;\n}', 'static inline unsigned int get_bits1(GetBitContext *s)\n{\n    unsigned int index = s->index;\n    uint8_t result = s->buffer[index>>3];\n#ifdef BITSTREAM_READER_LE\n    result >>= index & 7;\n    result &= 1;\n#else\n    result <<= index & 7;\n    result >>= 8 - 1;\n#endif\n#if !UNCHECKED_BITSTREAM_READER\n    if (s->index < s->size_in_bits_plus8)\n#endif\n        index++;\n    s->index = index;\n    return result;\n}']