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

libavcodec/flacdec.c:334:1: Parameter `s->bc.bits_left`
332. }
333. 
334. static inline int decode_subframe(FLACContext *s, int channel)
     ^
335. {
336.     int32_t *decoded = s->decoded[channel];

libavcodec/flacdec.c:349:9: Call
347.     }
348. 
349.     if (bitstream_read_bit(&s->bc)) {
             ^
350.         av_log(s->avctx, AV_LOG_ERROR, "invalid subframe padding\n");
351.         return AVERROR_INVALIDDATA;

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/flacdec.c:353:12: Call
351.         return AVERROR_INVALIDDATA;
352.     }
353.     type = bitstream_read(&s->bc, 6);
                ^
354. 
355.     if (bitstream_read_bit(&s->bc)) {

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, s->bc.bits_left), -1+max(64, s->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 inline int decode_subframe(FLACContext *s, int channel)\n{\n    int32_t *decoded = s->decoded[channel];\n    int type, wasted = 0;\n    int bps = s->bps;\n    int i, tmp, ret;\n    if (channel == 0) {\n        if (s->ch_mode == FLAC_CHMODE_RIGHT_SIDE)\n            bps++;\n    } else {\n        if (s->ch_mode == FLAC_CHMODE_LEFT_SIDE || s->ch_mode == FLAC_CHMODE_MID_SIDE)\n            bps++;\n    }\n    if (bitstream_read_bit(&s->bc)) {\n        av_log(s->avctx, AV_LOG_ERROR, "invalid subframe padding\\n");\n        return AVERROR_INVALIDDATA;\n    }\n    type = bitstream_read(&s->bc, 6);\n    if (bitstream_read_bit(&s->bc)) {\n        int left = bitstream_bits_left(&s->bc);\n        wasted = 1;\n        if ( left < 0 ||\n            (left < bps && !bitstream_peek(&s->bc, left)) ||\n                           !bitstream_peek(&s->bc, bps)) {\n            av_log(s->avctx, AV_LOG_ERROR,\n                   "Invalid number of wasted bits > available bits (%d) - left=%d\\n",\n                   bps, left);\n            return AVERROR_INVALIDDATA;\n        }\n        while (!bitstream_read_bit(&s->bc))\n            wasted++;\n        bps -= wasted;\n    }\n    if (bps > 32) {\n        avpriv_report_missing_feature(s->avctx, "Decorrelated bit depth > 32");\n        return AVERROR_PATCHWELCOME;\n    }\n    if (type == 0) {\n        tmp = bitstream_read_signed(&s->bc, bps);\n        for (i = 0; i < s->blocksize; i++)\n            decoded[i] = tmp;\n    } else if (type == 1) {\n        for (i = 0; i < s->blocksize; i++)\n            decoded[i] = bitstream_read_signed(&s->bc, bps);\n    } else if ((type >= 8) && (type <= 12)) {\n        if ((ret = decode_subframe_fixed(s, decoded, type & ~0x8, bps)) < 0)\n            return ret;\n    } else if (type >= 32) {\n        if ((ret = decode_subframe_lpc(s, decoded, (type & ~0x20)+1, bps)) < 0)\n            return ret;\n    } else {\n        av_log(s->avctx, AV_LOG_ERROR, "invalid coding type\\n");\n        return AVERROR_INVALIDDATA;\n    }\n    if (wasted) {\n        int i;\n        for (i = 0; i < s->blocksize; i++)\n            decoded[i] <<= wasted;\n    }\n    return 0;\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}']