libavcodec/dcadec.c:1464: error: Integer Overflow L2
  ([1, 2147483616] + 32):signed32 by call to `av_samples_fill_arrays`.

libavcodec/dcadec.c:1395:11: Call
1393.         s->core_ext_mask = 0;
1394. 
1395.     ret = scan_for_extensions(avctx);
                ^
1396. 
1397.     avctx->profile = s->profile;

libavcodec/dcadec.c:1145:1: Parameter `avctx->priv_data->xll_segments`
  1143. }
  1144. 
  1145. static int scan_for_extensions(AVCodecContext *avctx)
        ^
  1146. {
  1147.     DCAContext *s = avctx->priv_data;

libavcodec/dcadec.c:1409:9: Assignment
1407.     frame->nb_samples = 256 * (s->sample_blocks / 8);
1408.     if (s->exss_ext_mask & DCA_EXT_EXSS_XLL) {
1409.         int xll_nb_samples = s->xll_segments * s->xll_smpl_in_seg;
              ^
1410.         /* Check for invalid/unsupported conditions first */
1411.         if (s->xll_residual_channels > channels) {

libavcodec/dcadec.c:1464:15: Call
1462.             return AVERROR(ENOMEM);
1463. 
1464.         ret = av_samples_fill_arrays((uint8_t **) s->extra_channels, NULL,
                    ^
1465.                                      s->extra_channels_buffer,
1466.                                      full_channels - channels,

libavutil/samplefmt.c:140:1: Parameter `nb_samples`
  138. }
  139. 
  140. int av_samples_fill_arrays(uint8_t **audio_data, int *linesize,
       ^
  141.                            const uint8_t *buf, int nb_channels, int nb_samples,
  142.                            enum AVSampleFormat sample_fmt, int align)

libavutil/samplefmt.c:147:16: Call
  145. 
  146.     planar   = av_sample_fmt_is_planar(sample_fmt);
  147.     buf_size = av_samples_get_buffer_size(&line_size, nb_channels, nb_samples,
                      ^
  148.                                           sample_fmt, align);
  149.     if (buf_size < 0)

libavutil/samplefmt.c:108:1: <LHS trace>
106. }
107. 
108. int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples,
     ^
109.                                enum AVSampleFormat sample_fmt, int align)
110. {

libavutil/samplefmt.c:108:1: Parameter `nb_samples`
    106. }
    107. 
    108. int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples,
         ^
    109.                                enum AVSampleFormat sample_fmt, int align)
    110. {

libavutil/samplefmt.c:124:9: Binary operation: ([1, 2147483616] + 32):signed32 by call to `av_samples_fill_arrays` 
    122.             return AVERROR(EINVAL);
    123.         align = 1;
    124.         nb_samples = FFALIGN(nb_samples, 32);
                 ^
    125.     }
    126. 

int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples,
                               enum AVSampleFormat sample_fmt, int align)
{
    int line_size;
    int sample_size = av_get_bytes_per_sample(sample_fmt);
    int planar      = av_sample_fmt_is_planar(sample_fmt);
    if (!sample_size || nb_samples <= 0 || nb_channels <= 0)
        return AVERROR(EINVAL);
    if (!align) {
        if (nb_samples > INT_MAX - 31)
            return AVERROR(EINVAL);
        align = 1;
        nb_samples = FFALIGN(nb_samples, 32);
    }
    if (nb_channels > INT_MAX / align ||
        (int64_t)nb_channels * nb_samples > (INT_MAX - (align * nb_channels)) / sample_size)
        return AVERROR(EINVAL);
    line_size = planar ? FFALIGN(nb_samples * sample_size,               align) :
                         FFALIGN(nb_samples * sample_size * nb_channels, align);
    if (linesize)
        *linesize = line_size;
    return planar ? line_size * nb_channels : line_size;
}
['static int dca_decode_frame(AVCodecContext *avctx, void *data,\n                            int *got_frame_ptr, AVPacket *avpkt)\n{\n    AVFrame *frame     = data;\n    const uint8_t *buf = avpkt->data;\n    int buf_size       = avpkt->size;\n    int lfe_samples;\n    int num_core_channels = 0;\n    int i, ret;\n    float  **samples_flt;\n    DCAContext *s = avctx->priv_data;\n    int channels, full_channels;\n    int upsample = 0;\n    s->exss_ext_mask = 0;\n    s->xch_present   = 0;\n    s->dca_buffer_size = ff_dca_convert_bitstream(buf, buf_size, s->dca_buffer,\n                                                  DCA_MAX_FRAME_SIZE + DCA_MAX_EXSS_HEADER_SIZE);\n    if (s->dca_buffer_size == AVERROR_INVALIDDATA) {\n        av_log(avctx, AV_LOG_ERROR, "Not a valid DCA frame\\n");\n        return AVERROR_INVALIDDATA;\n    }\n    if ((ret = dca_parse_frame_header(s)) < 0) {\n        return ret;\n    }\n    avctx->sample_rate = s->sample_rate;\n    avctx->bit_rate    = s->bit_rate;\n    s->profile = FF_PROFILE_DTS;\n    for (i = 0; i < (s->sample_blocks / 8); i++) {\n        if ((ret = dca_decode_block(s, 0, i))) {\n            av_log(avctx, AV_LOG_ERROR, "error decoding block\\n");\n            return ret;\n        }\n    }\n    num_core_channels = s->prim_channels;\n    if (s->ext_coding)\n        s->core_ext_mask = dca_ext_audio_descr_mask[s->ext_descr];\n    else\n        s->core_ext_mask = 0;\n    ret = scan_for_extensions(avctx);\n    avctx->profile = s->profile;\n    full_channels = channels = s->prim_channels + !!s->lfe;\n    ret = set_channel_layout(avctx, channels, num_core_channels);\n    if (ret < 0)\n        return ret;\n    avctx->channels = channels;\n    frame->nb_samples = 256 * (s->sample_blocks / 8);\n    if (s->exss_ext_mask & DCA_EXT_EXSS_XLL) {\n        int xll_nb_samples = s->xll_segments * s->xll_smpl_in_seg;\n        if (s->xll_residual_channels > channels) {\n            av_log(s->avctx, AV_LOG_WARNING,\n                   "DCA: too many residual channels (%d, core channels %d). Disabling XLL\\n",\n                   s->xll_residual_channels, channels);\n            s->exss_ext_mask &= ~DCA_EXT_EXSS_XLL;\n        } else if (xll_nb_samples != frame->nb_samples &&\n                   2 * frame->nb_samples != xll_nb_samples) {\n            av_log(s->avctx, AV_LOG_WARNING,\n                   "DCA: unsupported upsampling (%d XLL samples, %d core samples). Disabling XLL\\n",\n                   xll_nb_samples, frame->nb_samples);\n            s->exss_ext_mask &= ~DCA_EXT_EXSS_XLL;\n        } else {\n            if (2 * frame->nb_samples == xll_nb_samples) {\n                av_log(s->avctx, AV_LOG_INFO,\n                       "XLL: upsampling core channels by a factor of 2\\n");\n                upsample = 1;\n                frame->nb_samples = xll_nb_samples;\n                avctx->sample_rate = s->xll_chsets[0].sampling_frequency;\n            }\n            if (!s->xch_disable)\n                avctx->channels += s->xll_channels - s->xll_residual_channels;\n        }\n    }\n    if (av_get_channel_layout_nb_channels(avctx->channel_layout) != avctx->channels)\n        avctx->channel_layout = 0;\n    if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) {\n        av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\\n");\n        return ret;\n    }\n    samples_flt = (float **) frame->extended_data;\n    if (avctx->channels < full_channels) {\n        ret = av_samples_get_buffer_size(NULL, full_channels - channels,\n                                         frame->nb_samples,\n                                         avctx->sample_fmt, 0);\n        if (ret < 0)\n            return ret;\n        av_fast_malloc(&s->extra_channels_buffer,\n                       &s->extra_channels_buffer_size, ret);\n        if (!s->extra_channels_buffer)\n            return AVERROR(ENOMEM);\n        ret = av_samples_fill_arrays((uint8_t **) s->extra_channels, NULL,\n                                     s->extra_channels_buffer,\n                                     full_channels - channels,\n                                     frame->nb_samples, avctx->sample_fmt, 0);\n        if (ret < 0)\n            return ret;\n    }\n    for (i = 0; i < (s->sample_blocks / 8); i++) {\n        int ch;\n        unsigned block = upsample ? 512 : 256;\n        for (ch = 0; ch < channels; ch++)\n            s->samples_chanptr[ch] = samples_flt[ch] + i * block;\n        for (; ch < full_channels; ch++)\n            s->samples_chanptr[ch] = s->extra_channels[ch - channels] + i * block;\n        dca_filter_channels(s, i, upsample);\n        if ((s->source_pcm_res & 1) && s->xch_present) {\n            float *back_chan = s->samples_chanptr[s->channel_order_tab[s->xch_base_channel]];\n            float *lt_chan   = s->samples_chanptr[s->channel_order_tab[s->xch_base_channel - 2]];\n            float *rt_chan   = s->samples_chanptr[s->channel_order_tab[s->xch_base_channel - 1]];\n            s->fdsp.vector_fmac_scalar(lt_chan, back_chan, -M_SQRT1_2, 256);\n            s->fdsp.vector_fmac_scalar(rt_chan, back_chan, -M_SQRT1_2, 256);\n        }\n    }\n    lfe_samples = 2 * s->lfe * (s->sample_blocks / 8);\n    for (i = 0; i < 2 * s->lfe * 4; i++)\n        s->lfe_data[i] = s->lfe_data[i + lfe_samples];\n    if (s->exss_ext_mask & DCA_EXT_EXSS_XLL) {\n        ret = ff_dca_xll_decode_audio(s, frame);\n        if (ret < 0)\n            return ret;\n    }\n    ret = ff_side_data_update_matrix_encoding(frame,\n                                              (s->output & ~DCA_LFE) == DCA_STEREO_TOTAL ?\n                                              AV_MATRIX_ENCODING_DOLBY : AV_MATRIX_ENCODING_NONE);\n    if (ret < 0)\n        return ret;\n    *got_frame_ptr = 1;\n    return buf_size;\n}', 'static int scan_for_extensions(AVCodecContext *avctx)\n{\n    DCAContext *s = avctx->priv_data;\n    int core_ss_end, ret;\n    core_ss_end = FFMIN(s->frame_size, s->dca_buffer_size) * 8;\n    if (s->core_ext_mask < 0 || s->core_ext_mask & DCA_EXT_XCH) {\n        s->core_ext_mask = FFMAX(s->core_ext_mask, 0);\n        skip_bits_long(&s->gb, (-get_bits_count(&s->gb)) & 31);\n        while (core_ss_end - get_bits_count(&s->gb) >= 32) {\n            uint32_t bits = get_bits_long(&s->gb, 32);\n            int i;\n            switch (bits) {\n            case DCA_SYNCWORD_XCH: {\n                int ext_amode, xch_fsize;\n                s->xch_base_channel = s->prim_channels;\n                xch_fsize = show_bits(&s->gb, 10);\n                if ((s->frame_size != (get_bits_count(&s->gb) >> 3) - 4 + xch_fsize) &&\n                    (s->frame_size != (get_bits_count(&s->gb) >> 3) - 4 + xch_fsize + 1))\n                    continue;\n                skip_bits(&s->gb, 10);\n                s->core_ext_mask |= DCA_EXT_XCH;\n                if ((ext_amode = get_bits(&s->gb, 4)) != 1) {\n                    av_log(avctx, AV_LOG_ERROR,\n                           "XCh extension amode %d not supported!\\n",\n                           ext_amode);\n                    continue;\n                }\n                dca_parse_audio_coding_header(s, s->xch_base_channel);\n                for (i = 0; i < (s->sample_blocks / 8); i++)\n                    if ((ret = dca_decode_block(s, s->xch_base_channel, i))) {\n                        av_log(avctx, AV_LOG_ERROR, "error decoding XCh extension\\n");\n                        continue;\n                    }\n                s->xch_present = 1;\n                break;\n            }\n            case DCA_SYNCWORD_XXCH:\n                s->core_ext_mask |= DCA_EXT_XXCH;\n                break;\n            case 0x1d95f262: {\n                int fsize96 = show_bits(&s->gb, 12) + 1;\n                if (s->frame_size != (get_bits_count(&s->gb) >> 3) - 4 + fsize96)\n                    continue;\n                av_log(avctx, AV_LOG_DEBUG, "X96 extension found at %d bits\\n",\n                       get_bits_count(&s->gb));\n                skip_bits(&s->gb, 12);\n                av_log(avctx, AV_LOG_DEBUG, "FSIZE96 = %d bytes\\n", fsize96);\n                av_log(avctx, AV_LOG_DEBUG, "REVNO = %d\\n", get_bits(&s->gb, 4));\n                s->core_ext_mask |= DCA_EXT_X96;\n                break;\n            }\n            }\n            skip_bits_long(&s->gb, (-get_bits_count(&s->gb)) & 31);\n        }\n    } else {\n        skip_bits_long(&s->gb, core_ss_end - get_bits_count(&s->gb));\n    }\n    if (s->core_ext_mask & DCA_EXT_X96)\n        s->profile = FF_PROFILE_DTS_96_24;\n    else if (s->core_ext_mask & (DCA_EXT_XCH | DCA_EXT_XXCH))\n        s->profile = FF_PROFILE_DTS_ES;\n    if (s->dca_buffer_size - s->frame_size > 32 &&\n        get_bits_long(&s->gb, 32) == DCA_SYNCWORD_SUBSTREAM)\n        ff_dca_exss_parse_header(s);\n    return ret;\n}', 'int av_samples_fill_arrays(uint8_t **audio_data, int *linesize,\n                           const uint8_t *buf, int nb_channels, int nb_samples,\n                           enum AVSampleFormat sample_fmt, int align)\n{\n    int ch, planar, buf_size, line_size;\n    planar   = av_sample_fmt_is_planar(sample_fmt);\n    buf_size = av_samples_get_buffer_size(&line_size, nb_channels, nb_samples,\n                                          sample_fmt, align);\n    if (buf_size < 0)\n        return buf_size;\n    audio_data[0] = buf;\n    for (ch = 1; planar && ch < nb_channels; ch++)\n        audio_data[ch] = audio_data[ch-1] + line_size;\n    if (linesize)\n        *linesize = line_size;\n    return 0;\n}', 'int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples,\n                               enum AVSampleFormat sample_fmt, int align)\n{\n    int line_size;\n    int sample_size = av_get_bytes_per_sample(sample_fmt);\n    int planar      = av_sample_fmt_is_planar(sample_fmt);\n    if (!sample_size || nb_samples <= 0 || nb_channels <= 0)\n        return AVERROR(EINVAL);\n    if (!align) {\n        if (nb_samples > INT_MAX - 31)\n            return AVERROR(EINVAL);\n        align = 1;\n        nb_samples = FFALIGN(nb_samples, 32);\n    }\n    if (nb_channels > INT_MAX / align ||\n        (int64_t)nb_channels * nb_samples > (INT_MAX - (align * nb_channels)) / sample_size)\n        return AVERROR(EINVAL);\n    line_size = planar ? FFALIGN(nb_samples * sample_size,               align) :\n                         FFALIGN(nb_samples * sample_size * nb_channels, align);\n    if (linesize)\n        *linesize = line_size;\n    return planar ? line_size * nb_channels : line_size;\n}']