libavcodec/cook.c:914: error: Integer Overflow L2
  ([0, +oo] - 1):unsigned32 by call to `joint_decode`.

libavcodec/cook.c:911:5: Call
909. 
910.     memset(q->decode_buffer_1, 0, sizeof(q->decode_buffer_1));
911.     decode_bytes_and_gain(q, p, inbuffer, &p->gains1);
         ^
912. 
913.     if (p->joint_stereo) {

libavcodec/cook.c:856:5: Call
  854.     bitstream_init(&q->bc, q->decoded_bytes_buffer + offset,
  855.                    p->bits_per_subpacket);
  856.     decode_gain_info(&q->bc, gains_ptr->now);
           ^
  857. 
  858.     /* Swap current and previous gains */

libavcodec/cook.c:344:45: Call
    342.     while (n--) {
    343.         int index = bitstream_read(bc, 3);
    344.         int gain = bitstream_read_bit(bc) ? bitstream_read(bc, 4) - 7 : -1;
                                                     ^
    345. 
    346.         while (i <= index)

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/cook.c:914:20: Call
912. 
913.     if (p->joint_stereo) {
914.         if ((res = joint_decode(q, p, q->decode_buffer_1, q->decode_buffer_2)) < 0)
                        ^
915.             return res;
916.     } else {

libavcodec/cook.c:794:1: Parameter `q->bc.bits_left`
  792.  * @param mlt_buffer2       pointer to right channel mlt coefficients
  793.  */
  794. static int joint_decode(COOKContext *q, COOKSubpacket *p,
       ^
  795.                         float *mlt_buffer_left, float *mlt_buffer_right)
  796. {

libavcodec/cook.c:809:5: Call
  807.     memset(mlt_buffer_left,  0, 1024 * sizeof(*mlt_buffer_left));
  808.     memset(mlt_buffer_right, 0, 1024 * sizeof(*mlt_buffer_right));
  809.     decouple_info(q, p, decouple_tab);
           ^
  810.     if ((res = mono_decode(q, p, decode_buffer)) < 0)
  811.         return res;

libavcodec/cook.c:739:1: Parameter `q->bc.bits_left`
    737.  * @param decouple_tab      decoupling array
    738.  */
    739. static void decouple_info(COOKContext *q, COOKSubpacket *p, int *decouple_tab)
         ^
    740. {
    741.     int i;

libavcodec/cook.c:742:18: Call
    740. {
    741.     int i;
    742.     int vlc    = bitstream_read_bit(&q->bc);
                          ^
    743.     int start  = cplband[p->js_subband_start];
    744.     int end    = cplband[p->subbands - 1];

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

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

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: ([0, +oo] - 1):unsigned32 by call to `joint_decode` 
        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;
}
['static int decode_subpacket(COOKContext *q, COOKSubpacket *p,\n                            const uint8_t *inbuffer, float **outbuffer)\n{\n    int sub_packet_size = p->size;\n    int res;\n    memset(q->decode_buffer_1, 0, sizeof(q->decode_buffer_1));\n    decode_bytes_and_gain(q, p, inbuffer, &p->gains1);\n    if (p->joint_stereo) {\n        if ((res = joint_decode(q, p, q->decode_buffer_1, q->decode_buffer_2)) < 0)\n            return res;\n    } else {\n        if ((res = mono_decode(q, p, q->decode_buffer_1)) < 0)\n            return res;\n        if (p->num_channels == 2) {\n            decode_bytes_and_gain(q, p, inbuffer + sub_packet_size / 2, &p->gains2);\n            if ((res = mono_decode(q, p, q->decode_buffer_2)) < 0)\n                return res;\n        }\n    }\n    mlt_compensate_output(q, q->decode_buffer_1, &p->gains1,\n                          p->mono_previous_buffer1,\n                          outbuffer ? outbuffer[p->ch_idx] : NULL);\n    if (p->num_channels == 2)\n        if (p->joint_stereo)\n            mlt_compensate_output(q, q->decode_buffer_2, &p->gains1,\n                                  p->mono_previous_buffer2,\n                                  outbuffer ? outbuffer[p->ch_idx + 1] : NULL);\n        else\n            mlt_compensate_output(q, q->decode_buffer_2, &p->gains2,\n                                  p->mono_previous_buffer2,\n                                  outbuffer ? outbuffer[p->ch_idx + 1] : NULL);\n    return 0;\n}', 'static inline void decode_bytes_and_gain(COOKContext *q, COOKSubpacket *p,\n                                         const uint8_t *inbuffer,\n                                         cook_gains *gains_ptr)\n{\n    int offset;\n    offset = decode_bytes(inbuffer, q->decoded_bytes_buffer,\n                          p->bits_per_subpacket / 8);\n    bitstream_init(&q->bc, q->decoded_bytes_buffer + offset,\n                   p->bits_per_subpacket);\n    decode_gain_info(&q->bc, gains_ptr->now);\n    FFSWAP(int *, gains_ptr->now, gains_ptr->previous);\n}', 'static void decode_gain_info(BitstreamContext *bc, int *gaininfo)\n{\n    int i, n;\n    while (bitstream_read_bit(bc)) {\n    }\n    n = bitstream_tell(bc) - 1;\n    i = 0;\n    while (n--) {\n        int index = bitstream_read(bc, 3);\n        int gain = bitstream_read_bit(bc) ? bitstream_read(bc, 4) - 7 : -1;\n        while (i <= index)\n            gaininfo[i++] = gain;\n    }\n    while (i <= 8)\n        gaininfo[i++] = 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 joint_decode(COOKContext *q, COOKSubpacket *p,\n                        float *mlt_buffer_left, float *mlt_buffer_right)\n{\n    int i, j, res;\n    int decouple_tab[SUBBAND_SIZE] = { 0 };\n    float *decode_buffer = q->decode_buffer_0;\n    int idx, cpl_tmp;\n    float f1, f2;\n    const float *cplscale;\n    memset(decode_buffer, 0, sizeof(q->decode_buffer_0));\n    memset(mlt_buffer_left,  0, 1024 * sizeof(*mlt_buffer_left));\n    memset(mlt_buffer_right, 0, 1024 * sizeof(*mlt_buffer_right));\n    decouple_info(q, p, decouple_tab);\n    if ((res = mono_decode(q, p, decode_buffer)) < 0)\n        return res;\n    for (i = 0; i < p->js_subband_start; i++) {\n        for (j = 0; j < SUBBAND_SIZE; j++) {\n            mlt_buffer_left[i  * 20 + j] = decode_buffer[i * 40 + j];\n            mlt_buffer_right[i * 20 + j] = decode_buffer[i * 40 + 20 + j];\n        }\n    }\n    idx = (1 << p->js_vlc_bits) - 1;\n    for (i = p->js_subband_start; i < p->subbands; i++) {\n        cpl_tmp = cplband[i];\n        idx -= decouple_tab[cpl_tmp];\n        cplscale = q->cplscales[p->js_vlc_bits - 2];\n        f1 = cplscale[decouple_tab[cpl_tmp] + 1];\n        f2 = cplscale[idx];\n        q->decouple(q, p, i, f1, f2, decode_buffer,\n                    mlt_buffer_left, mlt_buffer_right);\n        idx = (1 << p->js_vlc_bits) - 1;\n    }\n    return 0;\n}', 'static void decouple_info(COOKContext *q, COOKSubpacket *p, int *decouple_tab)\n{\n    int i;\n    int vlc    = bitstream_read_bit(&q->bc);\n    int start  = cplband[p->js_subband_start];\n    int end    = cplband[p->subbands - 1];\n    int length = end - start + 1;\n    if (start > end)\n        return;\n    if (vlc)\n        for (i = 0; i < length; i++)\n            decouple_tab[start + i] =\n                bitstream_read_vlc(&q->bc,\n                                   p->channel_coupling.table,\n                                   p->channel_coupling.bits, 2);\n    else\n        for (i = 0; i < length; i++)\n            decouple_tab[start + i] = bitstream_read(&q->bc, p->js_vlc_bits);\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}']