libavcodec/dxtory.c:332: error: Integer Overflow L2
  ([1, +oo] - 5):unsigned32 by call to `decode_sym_565`.

libavcodec/dxtory.c:332:17: Call
330.             b = decode_sym_565(bc, lru[0], 5);
331.             g = decode_sym_565(bc, lru[1], is_565 ? 6 : 5);
332.             r = decode_sym_565(bc, lru[2], 5);
                     ^
333.             dst[x * 3 + 0] = (r << 3) | (r >> 2);
334.             dst[x * 3 + 1] = is_565 ? (g << 2) | (g >> 4) : (g << 3) | (g >> 2);

libavcodec/dxtory.c:246:1: Parameter `bits`
  244. }
  245. 
  246. static inline uint8_t decode_sym_565(BitstreamContext *bc, uint8_t lru[8],
       ^
  247.                                      int bits)
  248. {

libavcodec/dxtory.c:253:15: Call
  251.     c = get_unary(bc, 0, bits);
  252.     if (!c) {
  253.         val = bitstream_read(bc, bits);
                     ^
  254.         memmove(lru + 1, lru, sizeof(*lru) * (6 - 1));
  255.     } else {

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

libavcodec/bitstream.h:194:12: Call
    192.     }
    193. 
    194.     return get_val(bc, n);
                    ^
    195. }
    196. 

libavcodec/bitstream.h:130:1: <LHS trace>
128. }
129. 
130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n)
     ^
131. {
132. #ifdef BITSTREAM_READER_LE

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

libavcodec/bitstream.h:130:1: <RHS trace>
128. }
129. 
130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n)
     ^
131. {
132. #ifdef BITSTREAM_READER_LE

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

libavcodec/bitstream.h:139:5: Binary operation: ([1, +oo] - 5):unsigned32 by call to `decode_sym_565` 
      137.     bc->bits <<= n;
      138. #endif
      139.     bc->bits_left -= n;
               ^
      140. 
      141.     return ret;

static inline uint64_t get_val(BitstreamContext *bc, unsigned n)
{
#ifdef BITSTREAM_READER_LE
    uint64_t ret = bc->bits & ((UINT64_C(1) << n) - 1);
    bc->bits >>= n;
#else
    uint64_t ret = bc->bits >> (64 - n);
    bc->bits <<= n;
#endif
    bc->bits_left -= n;
    return ret;
}
['av_always_inline\nstatic int dx2_decode_slice_5x5(BitstreamContext *bc, AVFrame *frame,\n                                int line, int left, uint8_t lru[3][8],\n                                int is_565)\n{\n    int x, y;\n    int r, g, b;\n    int width    = frame->width;\n    int stride   = frame->linesize[0];\n    uint8_t *dst = frame->data[0] + stride * line;\n    for (y = 0; y < left && bitstream_bits_left(bc) > 16; y++) {\n        for (x = 0; x < width; x++) {\n            b = decode_sym_565(bc, lru[0], 5);\n            g = decode_sym_565(bc, lru[1], is_565 ? 6 : 5);\n            r = decode_sym_565(bc, lru[2], 5);\n            dst[x * 3 + 0] = (r << 3) | (r >> 2);\n            dst[x * 3 + 1] = is_565 ? (g << 2) | (g >> 4) : (g << 3) | (g >> 2);\n            dst[x * 3 + 2] = (b << 3) | (b >> 2);\n        }\n        dst += stride;\n    }\n    return y;\n}', 'static inline uint8_t decode_sym_565(BitstreamContext *bc, uint8_t lru[8],\n                                     int bits)\n{\n    uint8_t c, val;\n    c = get_unary(bc, 0, bits);\n    if (!c) {\n        val = bitstream_read(bc, bits);\n        memmove(lru + 1, lru, sizeof(*lru) * (6 - 1));\n    } else {\n        val = lru[c - 1];\n        memmove(lru + 1, lru, sizeof(*lru) * (c - 1));\n    }\n    lru[0] = val;\n    return val;\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 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}']