libavcodec/dss_sp.c:330: error: Integer Overflow L2
  ([1, +oo] - 31):unsigned32 by call to `bitstream_read`.

libavcodec/dss_sp.c:330:55: Call
328.         fparam->sf_adaptive_gain[subframe_idx] = bitstream_read(&bc, 5);
329. 
330.         fparam->sf[subframe_idx].combined_pulse_pos = bitstream_read(&bc, 31);
                                                           ^
331. 
332.         fparam->sf[subframe_idx].gain = bitstream_read(&bc, 6);

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] - 31):unsigned32 by call to `bitstream_read` 
    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 void dss_sp_unpack_coeffs(DssSpContext *p, const uint8_t *src)\n{\n    BitstreamContext bc;\n    DssSpFrame *fparam = &p->fparam;\n    int i;\n    int subframe_idx;\n    uint32_t combined_pitch;\n    uint32_t tmp;\n    uint32_t pitch_lag;\n    for (i = 0; i < DSS_SP_FRAME_SIZE; i += 2) {\n        p->bits[i]     = src[i + 1];\n        p->bits[i + 1] = src[i];\n    }\n    bitstream_init(&bc, p->bits, DSS_SP_FRAME_SIZE * 8);\n    for (i = 0; i < 2; i++)\n        fparam->filter_idx[i] = bitstream_read(&bc, 5);\n    for (; i < 8; i++)\n        fparam->filter_idx[i] = bitstream_read(&bc, 4);\n    for (; i < 14; i++)\n        fparam->filter_idx[i] = bitstream_read(&bc, 3);\n    for (subframe_idx = 0; subframe_idx < 4; subframe_idx++) {\n        fparam->sf_adaptive_gain[subframe_idx] = bitstream_read(&bc, 5);\n        fparam->sf[subframe_idx].combined_pulse_pos = bitstream_read(&bc, 31);\n        fparam->sf[subframe_idx].gain = bitstream_read(&bc, 6);\n        for (i = 0; i < 7; i++)\n            fparam->sf[subframe_idx].pulse_val[i] = bitstream_read(&bc, 3);\n    }\n    for (subframe_idx = 0; subframe_idx < 4; subframe_idx++) {\n        unsigned int C72_binomials[PULSE_MAX] = {\n            72, 2556, 59640, 1028790, 13991544, 156238908, 1473109704,\n            3379081753\n        };\n        unsigned int combined_pulse_pos =\n            fparam->sf[subframe_idx].combined_pulse_pos;\n        int index = 6;\n        if (combined_pulse_pos < C72_binomials[PULSE_MAX - 1]) {\n            if (p->pulse_dec_mode) {\n                int pulse, pulse_idx;\n                pulse              = PULSE_MAX - 1;\n                pulse_idx          = 71;\n                combined_pulse_pos =\n                    fparam->sf[subframe_idx].combined_pulse_pos;\n                for (i = 0; i < 7; i++) {\n                    for (;\n                         combined_pulse_pos <\n                         dss_sp_combinatorial_table[pulse][pulse_idx];\n                         --pulse_idx)\n                        ;\n                    combined_pulse_pos -=\n                        dss_sp_combinatorial_table[pulse][pulse_idx];\n                    pulse--;\n                    fparam->sf[subframe_idx].pulse_pos[i] = pulse_idx;\n                }\n            }\n        } else {\n            p->pulse_dec_mode = 0;\n            fparam->sf[subframe_idx].pulse_pos[6] = 0;\n            for (i = 71; i >= 0; i--) {\n                if (C72_binomials[index] <= combined_pulse_pos) {\n                    combined_pulse_pos -= C72_binomials[index];\n                    fparam->sf[subframe_idx].pulse_pos[(index ^ 7) - 1] = i;\n                    if (!index)\n                        break;\n                    --index;\n                }\n                --C72_binomials[0];\n                if (index) {\n                    int a;\n                    for (a = 0; a < index; a++)\n                        C72_binomials[a + 1] -= C72_binomials[a];\n                }\n            }\n        }\n    }\n    combined_pitch = bitstream_read(&bc, 24);\n    fparam->pitch_lag[0] = (combined_pitch % 151) + 36;\n    combined_pitch /= 151;\n    for (i = 1; i < SUBFRAMES; i++) {\n        fparam->pitch_lag[i] = combined_pitch % 48;\n        combined_pitch      /= 48;\n    }\n    pitch_lag = fparam->pitch_lag[0];\n    for (i = 1; i < SUBFRAMES; i++) {\n        if (pitch_lag > 162) {\n            fparam->pitch_lag[i] += 162 - 23;\n        } else {\n            tmp = pitch_lag - 23;\n            if (tmp < 36)\n                tmp = 36;\n            fparam->pitch_lag[i] += tmp;\n        }\n        pitch_lag = fparam->pitch_lag[i];\n    }\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}']