libavcodec/smacker.c:117: error: Integer Overflow L2
  (32 - [-1+min(64, `bc->bits_left`), -1+max(64, `bc->bits_left`)]):unsigned32 by call to `bitstream_read`.

libavcodec/smacker.c:97:1: Parameter `bc->bits_left`
95.  * Decode local frame tree
96.  */
97. static int smacker_decode_tree(BitstreamContext *bc, HuffContext *hc,
    ^
98.                                uint32_t prefix, int length)
99. {

libavcodec/smacker.c:105:10: Call
103.     }
104. 
105.     if (!bitstream_read_bit(bc)) { // Leaf
              ^
106.         if(hc->current >= 256){
107.             av_log(NULL, AV_LOG_ERROR, "Tree size exceeded!\n");

libavcodec/bitstream.h:144:1: Parameter `bc->bits_left`
  142. 
  143. /* Return one bit from the buffer. */
  144. static inline unsigned bitstream_read_bit(BitstreamContext *bc)
       ^
  145. {
  146.     if (!bc->bits_left)

libavcodec/bitstream.h:149:12: Call
  147.         refill_64(bc);
  148. 
  149.     return get_val(bc, 1);
                  ^
  150. }
  151. 

libavcodec/bitstream.h:129:1: Parameter `n`
    127. }
    128. 
    129. static inline uint64_t get_val(BitstreamContext *bc, unsigned n)
         ^
    130. {
    131. #ifdef BITSTREAM_READER_LE

libavcodec/bitstream.h:138:5: Assignment
    136.     bc->bits <<= n;
    137. #endif
    138.     bc->bits_left -= n;
             ^
    139. 
    140.     return ret;

libavcodec/smacker.c:117:35: Call
115.             hc->lengths[hc->current] = 0;
116.         }
117.         hc->values[hc->current] = bitstream_read(bc, 8);
                                       ^
118.         hc->current++;
119.         if(hc->maxlength < length)

libavcodec/bitstream.h:182:1: Parameter `n`
  180. 
  181. /* Return n bits from the buffer. n has to be in the 0-32 range. */
  182. static inline uint32_t bitstream_read(BitstreamContext *bc, unsigned n)
       ^
  183. {
  184.     if (!n)

libavcodec/bitstream.h:188:9: Call
  186. 
  187.     if (n > bc->bits_left) {
  188.         refill_32(bc);
               ^
  189.         if (bc->bits_left < 32)
  190.             bc->bits_left = n;

libavcodec/bitstream.h:59:1: <RHS trace>
57. }
58. 
59. static inline void refill_32(BitstreamContext *bc)
    ^
60. {
61.     if (bc->ptr >= bc->buffer_end)

libavcodec/bitstream.h:59:1: Parameter `bc->bits_left`
    57. }
    58. 
    59. static inline void refill_32(BitstreamContext *bc)
        ^
    60. {
    61.     if (bc->ptr >= bc->buffer_end)

libavcodec/bitstream.h:67:5: Binary operation: (32 - [-1+min(64, bc->bits_left), -1+max(64, bc->bits_left)]):unsigned32 by call to `bitstream_read` 
    65.     bc->bits       = (uint64_t)AV_RL32(bc->ptr) << bc->bits_left | bc->bits;
    66. #else
    67.     bc->bits       = bc->bits | (uint64_t)AV_RB32(bc->ptr) << (32 - bc->bits_left);
            ^
    68. #endif
    69.     bc->ptr       += 4;

static inline void refill_32(BitstreamContext *bc)
{
    if (bc->ptr >= bc->buffer_end)
        return;
#ifdef BITSTREAM_READER_LE
    bc->bits       = (uint64_t)AV_RL32(bc->ptr) << bc->bits_left | bc->bits;
#else
    bc->bits       = bc->bits | (uint64_t)AV_RB32(bc->ptr) << (32 - bc->bits_left);
#endif
    bc->ptr       += 4;
    bc->bits_left += 32;
}
['static int smacker_decode_tree(BitstreamContext *bc, HuffContext *hc,\n                               uint32_t prefix, int length)\n{\n    if (length > SMKTREE_DECODE_MAX_RECURSION) {\n        av_log(NULL, AV_LOG_ERROR, "Maximum tree recursion level exceeded.\\n");\n        return AVERROR_INVALIDDATA;\n    }\n    if (!bitstream_read_bit(bc)) {\n        if(hc->current >= 256){\n            av_log(NULL, AV_LOG_ERROR, "Tree size exceeded!\\n");\n            return AVERROR_INVALIDDATA;\n        }\n        if(length){\n            hc->bits[hc->current] = prefix;\n            hc->lengths[hc->current] = length;\n        } else {\n            hc->bits[hc->current] = 0;\n            hc->lengths[hc->current] = 0;\n        }\n        hc->values[hc->current] = bitstream_read(bc, 8);\n        hc->current++;\n        if(hc->maxlength < length)\n            hc->maxlength = length;\n        return 0;\n    } else {\n        int r;\n        length++;\n        r = smacker_decode_tree(bc, hc, prefix, length);\n        if(r)\n            return r;\n        return smacker_decode_tree(bc, hc, prefix | (1 << (length - 1)), length);\n    }\n}', 'static inline unsigned bitstream_read_bit(BitstreamContext *bc)\n{\n    if (!bc->bits_left)\n        refill_64(bc);\n    return get_val(bc, 1);\n}', 'static inline uint64_t get_val(BitstreamContext *bc, unsigned n)\n{\n#ifdef BITSTREAM_READER_LE\n    uint64_t ret = bc->bits & ((UINT64_C(1) << n) - 1);\n    bc->bits >>= n;\n#else\n    uint64_t ret = bc->bits >> (64 - n);\n    bc->bits <<= n;\n#endif\n    bc->bits_left -= n;\n    return ret;\n}', 'static inline uint32_t bitstream_read(BitstreamContext *bc, unsigned n)\n{\n    if (!n)\n        return 0;\n    if (n > bc->bits_left) {\n        refill_32(bc);\n        if (bc->bits_left < 32)\n            bc->bits_left = n;\n    }\n    return get_val(bc, n);\n}', 'static inline void refill_32(BitstreamContext *bc)\n{\n    if (bc->ptr >= bc->buffer_end)\n        return;\n#ifdef BITSTREAM_READER_LE\n    bc->bits       = (uint64_t)AV_RL32(bc->ptr) << bc->bits_left | bc->bits;\n#else\n    bc->bits       = bc->bits | (uint64_t)AV_RB32(bc->ptr) << (32 - bc->bits_left);\n#endif\n    bc->ptr       += 4;\n    bc->bits_left += 32;\n}']