libavcodec/hqx.c:175: error: Integer Overflow L2
  ([0, +oo] - 9):unsigned32 by call to `decode_block`.

libavcodec/hqx.c:169:25: Call
167.         flag = 0;
168. 
169.     quants = hqx_quants[bitstream_read(bc, 4)];
                             ^
170. 
171.     for (i = 0; i < 8; i++) {

libavcodec/bitstream.h:183:1: Parameter `bc->bits_left`
  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/hqx.c:175:15: Call
173.         if (i == 0 || i == 4 || i == 6)
174.             last_dc = 0;
175.         ret = decode_block(bc, &ctx->dc_vlc[vlc_index], quants,
                   ^
176.                            ctx->dcb, slice->block[i], &last_dc);
177.         if (ret < 0)

libavcodec/hqx.c:114:1: Parameter `bc->bits_left`
  112. }
  113. 
  114. static int decode_block(BitstreamContext *bc, VLC *vlc,
       ^
  115.                         const int *quants, int dcb,
  116.                         int16_t block[64], int *last_dc)

libavcodec/hqx.c:123:10: Call
  121. 
  122.     memset(block, 0, 64 * sizeof(*block));
  123.     dc = bitstream_read_vlc(bc, vlc->table, HQX_DC_VLC_BITS, 2);
                ^
  124.     if (dc < 0)
  125.         return AVERROR_INVALIDDATA;

libavcodec/bitstream.h:313:1: Parameter `bits`
    311.  * If the VLC code is invalid and max_depth > 1, then the number of bits removed
    312.  * is undefined. */
    313. static inline int bitstream_read_vlc(BitstreamContext *bc, VLC_TYPE (*table)[2],
         ^
    314.                                      int bits, int max_depth)
    315. {

libavcodec/bitstream.h:322:9: Call
    320. 
    321.     if (max_depth > 1 && n < 0) {
    322.         skip_remaining(bc, bits);
                 ^
    323.         code = set_idx(bc, code, &n, &nb_bits, table);
    324.         if (max_depth > 2 && n < 0) {

libavcodec/bitstream.h:230:1: <LHS trace>
228. }
229. 
230. static inline void skip_remaining(BitstreamContext *bc, unsigned n)
     ^
231. {
232. #ifdef BITSTREAM_READER_LE

libavcodec/bitstream.h:230:1: Parameter `bc->bits_left`
      228. }
      229. 
      230. static inline void skip_remaining(BitstreamContext *bc, unsigned n)
           ^
      231. {
      232. #ifdef BITSTREAM_READER_LE

libavcodec/bitstream.h:230:1: <RHS trace>
228. }
229. 
230. static inline void skip_remaining(BitstreamContext *bc, unsigned n)
     ^
231. {
232. #ifdef BITSTREAM_READER_LE

libavcodec/bitstream.h:230:1: Parameter `n`
      228. }
      229. 
      230. static inline void skip_remaining(BitstreamContext *bc, unsigned n)
           ^
      231. {
      232. #ifdef BITSTREAM_READER_LE

libavcodec/bitstream.h:237:5: Binary operation: ([0, +oo] - 9):unsigned32 by call to `decode_block` 
      235.     bc->bits <<= n;
      236. #endif
      237.     bc->bits_left -= n;
               ^
      238. }
      239. 

static inline void skip_remaining(BitstreamContext *bc, unsigned n)
{
#ifdef BITSTREAM_READER_LE
    bc->bits >>= n;
#else
    bc->bits <<= n;
#endif
    bc->bits_left -= n;
}
['static int hqx_decode_422(HQXContext *ctx, int slice_no, int x, int y)\n{\n    HQXSlice *slice = &ctx->slice[slice_no];\n    BitstreamContext *bc = &slice->bc;\n    const int *quants;\n    int flag;\n    int last_dc;\n    int i, ret;\n    if (ctx->interlaced)\n        flag = bitstream_read_bit(bc);\n    else\n        flag = 0;\n    quants = hqx_quants[bitstream_read(bc, 4)];\n    for (i = 0; i < 8; i++) {\n        int vlc_index = ctx->dcb - 9;\n        if (i == 0 || i == 4 || i == 6)\n            last_dc = 0;\n        ret = decode_block(bc, &ctx->dc_vlc[vlc_index], quants,\n                           ctx->dcb, slice->block[i], &last_dc);\n        if (ret < 0)\n            return ret;\n    }\n    put_blocks(ctx, 0, x,      y, flag, slice->block[0], slice->block[2], hqx_quant_luma);\n    put_blocks(ctx, 0, x + 8,  y, flag, slice->block[1], slice->block[3], hqx_quant_luma);\n    put_blocks(ctx, 2, x >> 1, y, flag, slice->block[4], slice->block[5], hqx_quant_chroma);\n    put_blocks(ctx, 1, x >> 1, y, flag, slice->block[6], slice->block[7], hqx_quant_chroma);\n    return 0;\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 int decode_block(BitstreamContext *bc, VLC *vlc,\n                        const int *quants, int dcb,\n                        int16_t block[64], int *last_dc)\n{\n    int q, dc;\n    int ac_idx;\n    int run, lev, pos = 1;\n    memset(block, 0, 64 * sizeof(*block));\n    dc = bitstream_read_vlc(bc, vlc->table, HQX_DC_VLC_BITS, 2);\n    if (dc < 0)\n        return AVERROR_INVALIDDATA;\n    *last_dc += dc;\n    block[0] = sign_extend(*last_dc << (12 - dcb), 12);\n    q = quants[bitstream_read(bc, 2)];\n    if (q >= 128)\n        ac_idx = HQX_AC_Q128;\n    else if (q >= 64)\n        ac_idx = HQX_AC_Q64;\n    else if (q >= 32)\n        ac_idx = HQX_AC_Q32;\n    else if (q >= 16)\n        ac_idx = HQX_AC_Q16;\n    else if (q >= 8)\n        ac_idx = HQX_AC_Q8;\n    else\n        ac_idx = HQX_AC_Q0;\n    do {\n        hqx_get_ac(bc, &ff_hqx_ac[ac_idx], &run, &lev);\n        pos += run;\n        if (pos >= 64)\n            break;\n        block[ff_zigzag_direct[pos++]] = lev * q;\n    } while (pos < 64);\n    return 0;\n}', 'static inline int bitstream_read_vlc(BitstreamContext *bc, VLC_TYPE (*table)[2],\n                                     int bits, int max_depth)\n{\n    int nb_bits;\n    unsigned idx = bitstream_peek(bc, bits);\n    int code = table[idx][0];\n    int n    = table[idx][1];\n    if (max_depth > 1 && n < 0) {\n        skip_remaining(bc, bits);\n        code = set_idx(bc, code, &n, &nb_bits, table);\n        if (max_depth > 2 && n < 0) {\n            skip_remaining(bc, nb_bits);\n            code = set_idx(bc, code, &n, &nb_bits, table);\n        }\n    }\n    skip_remaining(bc, n);\n    return code;\n}', 'static inline void skip_remaining(BitstreamContext *bc, unsigned n)\n{\n#ifdef BITSTREAM_READER_LE\n    bc->bits >>= n;\n#else\n    bc->bits <<= n;\n#endif\n    bc->bits_left -= n;\n}']