libavresample/utils.c:411: error: Integer Overflow L2
  ([1, 2147483616] + 32):signed32 by call to `ff_audio_convert`.

libavresample/utils.c:373:15: Call
371.     if (input) {
372.         /* initialize input_buffer with input data */
373.         ret = ff_audio_data_init(&input_buffer, input, in_plane_size,
                   ^
374.                                  avr->in_channels, in_samples,
375.                                  avr->in_sample_fmt, 1, "input");

libavresample/audio_data.c:73:1: Parameter `a->nb_samples`
  71. }
  72. 
  73. int ff_audio_data_init(AudioData *a, uint8_t * const *src, int plane_size,
      ^
  74.                        int channels, int nb_samples,
  75.                        enum AVSampleFormat sample_fmt, int read_only,

libavresample/utils.c:411:23: Call
409.                     return ret;
410.                 av_log(avr, AV_LOG_TRACE, "[convert] %s to in_buffer\n", current_buffer->name);
411.                 ret = ff_audio_convert(avr->ac_in, avr->in_buffer,
                           ^
412.                                        current_buffer);
413.                 if (ret < 0)

libavresample/audio_convert.c:314:1: Parameter `in->nb_samples`
  312. }
  313. 
  314. int ff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in)
       ^
  315. {
  316.     int use_generic = 1;

libavresample/audio_convert.c:326:16: Call
  324.                 av_get_sample_fmt_name(ac->out_fmt));
  325. 
  326.         return ff_convert_dither(ac->dc, out, in);
                      ^
  327.     }
  328. 

libavresample/dither.c:242:1: Parameter `src->nb_samples`
    240. }
    241. 
    242. int ff_convert_dither(DitherContext *c, AudioData *dst, AudioData *src)
         ^
    243. {
    244.     int ret;

libavresample/dither.c:252:15: Call
    250.     else {
    251.         /* make sure s16_data is large enough for the output */
    252.         ret = ff_audio_data_realloc(c->s16_data, src->nb_samples);
                       ^
    253.         if (ret < 0)
    254.             return ret;

libavresample/audio_data.c:162:1: Parameter `nb_samples`
      160. }
      161. 
      162. int ff_audio_data_realloc(AudioData *a, int nb_samples)
           ^
      163. {
      164.     int ret, new_buf_size, plane_size, p;

libavresample/audio_data.c:174:20: Call
      172.         return AVERROR(EINVAL);
      173. 
      174.     new_buf_size = av_samples_get_buffer_size(&plane_size,
                              ^
      175.                                               a->allocated_channels, nb_samples,
      176.                                               a->sample_fmt, 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 `ff_audio_convert` 
        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;
}
['int attribute_align_arg avresample_convert(AVAudioResampleContext *avr,\n                                           uint8_t **output, int out_plane_size,\n                                           int out_samples,\n                                           uint8_t * const *input,\n                                           int in_plane_size, int in_samples)\n{\n    AudioData input_buffer;\n    AudioData output_buffer;\n    AudioData *current_buffer;\n    int ret, direct_output;\n    if (avr->in_buffer) {\n        avr->in_buffer->nb_samples = 0;\n        ff_audio_data_set_channels(avr->in_buffer,\n                                   avr->in_buffer->allocated_channels);\n    }\n    if (avr->resample_out_buffer) {\n        avr->resample_out_buffer->nb_samples = 0;\n        ff_audio_data_set_channels(avr->resample_out_buffer,\n                                   avr->resample_out_buffer->allocated_channels);\n    }\n    if (avr->out_buffer) {\n        avr->out_buffer->nb_samples = 0;\n        ff_audio_data_set_channels(avr->out_buffer,\n                                   avr->out_buffer->allocated_channels);\n    }\n    av_log(avr, AV_LOG_TRACE, "[start conversion]\\n");\n    direct_output = output && av_audio_fifo_size(avr->out_fifo) == 0;\n    if (output) {\n        ret = ff_audio_data_init(&output_buffer, output, out_plane_size,\n                                 avr->out_channels, out_samples,\n                                 avr->out_sample_fmt, 0, "output");\n        if (ret < 0)\n            return ret;\n        output_buffer.nb_samples = 0;\n    }\n    if (input) {\n        ret = ff_audio_data_init(&input_buffer, input, in_plane_size,\n                                 avr->in_channels, in_samples,\n                                 avr->in_sample_fmt, 1, "input");\n        if (ret < 0)\n            return ret;\n        current_buffer = &input_buffer;\n        if (avr->upmix_needed && !avr->in_convert_needed && !avr->resample_needed &&\n            !avr->out_convert_needed && direct_output && out_samples >= in_samples) {\n            av_log(avr, AV_LOG_TRACE, "[copy] %s to output\\n", current_buffer->name);\n            ret = ff_audio_data_copy(&output_buffer, current_buffer,\n                                     avr->remap_point == REMAP_OUT_COPY ?\n                                     &avr->ch_map_info : NULL);\n            if (ret < 0)\n                return ret;\n            current_buffer = &output_buffer;\n        } else if (avr->remap_point == REMAP_OUT_COPY &&\n                   (!direct_output || out_samples < in_samples)) {\n            av_log(avr, AV_LOG_TRACE, "[copy] %s to out_buffer\\n", current_buffer->name);\n            ret = ff_audio_data_copy(avr->out_buffer, current_buffer,\n                                     &avr->ch_map_info);\n            if (ret < 0)\n                return ret;\n            current_buffer = avr->out_buffer;\n        } else if (avr->in_copy_needed || avr->in_convert_needed) {\n            if (avr->in_convert_needed) {\n                ret = ff_audio_data_realloc(avr->in_buffer,\n                                            current_buffer->nb_samples);\n                if (ret < 0)\n                    return ret;\n                av_log(avr, AV_LOG_TRACE, "[convert] %s to in_buffer\\n", current_buffer->name);\n                ret = ff_audio_convert(avr->ac_in, avr->in_buffer,\n                                       current_buffer);\n                if (ret < 0)\n                    return ret;\n            } else {\n                av_log(avr, AV_LOG_TRACE, "[copy] %s to in_buffer\\n", current_buffer->name);\n                ret = ff_audio_data_copy(avr->in_buffer, current_buffer,\n                                         avr->remap_point == REMAP_IN_COPY ?\n                                         &avr->ch_map_info : NULL);\n                if (ret < 0)\n                    return ret;\n            }\n            ff_audio_data_set_channels(avr->in_buffer, avr->in_channels);\n            if (avr->downmix_needed) {\n                av_log(avr, AV_LOG_TRACE, "[downmix] in_buffer\\n");\n                ret = ff_audio_mix(avr->am, avr->in_buffer);\n                if (ret < 0)\n                    return ret;\n            }\n            current_buffer = avr->in_buffer;\n        }\n    } else {\n        if (!avr->resample_needed)\n            return handle_buffered_output(avr, output ? &output_buffer : NULL,\n                                          NULL);\n        current_buffer = NULL;\n    }\n    if (avr->resample_needed) {\n        AudioData *resample_out;\n        if (!avr->out_convert_needed && direct_output && out_samples > 0)\n            resample_out = &output_buffer;\n        else\n            resample_out = avr->resample_out_buffer;\n        av_log(avr, AV_LOG_TRACE, "[resample] %s to %s\\n",\n                current_buffer ? current_buffer->name : "null",\n                resample_out->name);\n        ret = ff_audio_resample(avr->resample, resample_out,\n                                current_buffer);\n        if (ret < 0)\n            return ret;\n        if (resample_out->nb_samples == 0) {\n            av_log(avr, AV_LOG_TRACE, "[end conversion]\\n");\n            return 0;\n        }\n        current_buffer = resample_out;\n    }\n    if (avr->upmix_needed) {\n        av_log(avr, AV_LOG_TRACE, "[upmix] %s\\n", current_buffer->name);\n        ret = ff_audio_mix(avr->am, current_buffer);\n        if (ret < 0)\n            return ret;\n    }\n    if (current_buffer == &output_buffer) {\n        av_log(avr, AV_LOG_TRACE, "[end conversion]\\n");\n        return current_buffer->nb_samples;\n    }\n    if (avr->out_convert_needed) {\n        if (direct_output && out_samples >= current_buffer->nb_samples) {\n            av_log(avr, AV_LOG_TRACE, "[convert] %s to output\\n", current_buffer->name);\n            ret = ff_audio_convert(avr->ac_out, &output_buffer, current_buffer);\n            if (ret < 0)\n                return ret;\n            av_log(avr, AV_LOG_TRACE, "[end conversion]\\n");\n            return output_buffer.nb_samples;\n        } else {\n            ret = ff_audio_data_realloc(avr->out_buffer,\n                                        current_buffer->nb_samples);\n            if (ret < 0)\n                return ret;\n            av_log(avr, AV_LOG_TRACE, "[convert] %s to out_buffer\\n", current_buffer->name);\n            ret = ff_audio_convert(avr->ac_out, avr->out_buffer,\n                                   current_buffer);\n            if (ret < 0)\n                return ret;\n            current_buffer = avr->out_buffer;\n        }\n    }\n    return handle_buffered_output(avr, output ? &output_buffer : NULL,\n                                  current_buffer);\n}', 'int ff_audio_data_init(AudioData *a, uint8_t * const *src, int plane_size,\n                       int channels, int nb_samples,\n                       enum AVSampleFormat sample_fmt, int read_only,\n                       const char *name)\n{\n    int p;\n    memset(a, 0, sizeof(*a));\n    a->class = &audio_data_class;\n    if (channels < 1 || channels > AVRESAMPLE_MAX_CHANNELS) {\n        av_log(a, AV_LOG_ERROR, "invalid channel count: %d\\n", channels);\n        return AVERROR(EINVAL);\n    }\n    a->sample_size = av_get_bytes_per_sample(sample_fmt);\n    if (!a->sample_size) {\n        av_log(a, AV_LOG_ERROR, "invalid sample format\\n");\n        return AVERROR(EINVAL);\n    }\n    a->is_planar = ff_sample_fmt_is_planar(sample_fmt, channels);\n    a->planes    = a->is_planar ? channels : 1;\n    a->stride    = a->sample_size * (a->is_planar ? 1 : channels);\n    for (p = 0; p < (a->is_planar ? channels : 1); p++) {\n        if (!src[p]) {\n            av_log(a, AV_LOG_ERROR, "invalid NULL pointer for src[%d]\\n", p);\n            return AVERROR(EINVAL);\n        }\n        a->data[p] = src[p];\n    }\n    a->allocated_samples  = nb_samples * !read_only;\n    a->nb_samples         = nb_samples;\n    a->sample_fmt         = sample_fmt;\n    a->channels           = channels;\n    a->allocated_channels = channels;\n    a->read_only          = read_only;\n    a->allow_realloc      = 0;\n    a->name               = name ? name : "{no name}";\n    calc_ptr_alignment(a);\n    a->samples_align = plane_size / a->stride;\n    return 0;\n}', 'int ff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in)\n{\n    int use_generic = 1;\n    int len         = in->nb_samples;\n    int p;\n    if (ac->dc) {\n        av_log(ac->avr, AV_LOG_TRACE, "%d samples - audio_convert: %s to %s (dithered)\\n",\n                len, av_get_sample_fmt_name(ac->in_fmt),\n                av_get_sample_fmt_name(ac->out_fmt));\n        return ff_convert_dither(ac->dc, out, in);\n    }\n    if (ac->has_optimized_func) {\n        int ptr_align     = FFMIN(in->ptr_align,     out->ptr_align);\n        int samples_align = FFMIN(in->samples_align, out->samples_align);\n        int aligned_len   = FFALIGN(len, ac->samples_align);\n        if (!(ptr_align % ac->ptr_align) && samples_align >= aligned_len) {\n            len = aligned_len;\n            use_generic = 0;\n        }\n    }\n    av_log(ac->avr, AV_LOG_TRACE, "%d samples - audio_convert: %s to %s (%s)\\n", len,\n            av_get_sample_fmt_name(ac->in_fmt),\n            av_get_sample_fmt_name(ac->out_fmt),\n            use_generic ? ac->func_descr_generic : ac->func_descr);\n    if (ac->apply_map) {\n        ChannelMapInfo *map = &ac->avr->ch_map_info;\n        if (!ff_sample_fmt_is_planar(ac->out_fmt, ac->channels)) {\n            av_log(ac->avr, AV_LOG_ERROR, "cannot remap packed format during conversion\\n");\n            return AVERROR(EINVAL);\n        }\n        if (map->do_remap) {\n            if (ff_sample_fmt_is_planar(ac->in_fmt, ac->channels)) {\n                conv_func_flat *convert = use_generic ? ac->conv_flat_generic :\n                                                        ac->conv_flat;\n                for (p = 0; p < ac->planes; p++)\n                    if (map->channel_map[p] >= 0)\n                        convert(out->data[p], in->data[map->channel_map[p]], len);\n            } else {\n                uint8_t *data[AVRESAMPLE_MAX_CHANNELS];\n                conv_func_deinterleave *convert = use_generic ?\n                                                  ac->conv_deinterleave_generic :\n                                                  ac->conv_deinterleave;\n                for (p = 0; p < ac->channels; p++)\n                    data[map->input_map[p]] = out->data[p];\n                convert(data, in->data[0], len, ac->channels);\n            }\n        }\n        if (map->do_copy || map->do_zero) {\n            for (p = 0; p < ac->planes; p++) {\n                if (map->channel_copy[p])\n                    memcpy(out->data[p], out->data[map->channel_copy[p]],\n                           len * out->stride);\n                else if (map->channel_zero[p])\n                    av_samples_set_silence(&out->data[p], 0, len, 1, ac->out_fmt);\n            }\n        }\n    } else {\n        switch (ac->func_type) {\n        case CONV_FUNC_TYPE_FLAT: {\n            if (!in->is_planar)\n                len *= in->channels;\n            if (use_generic) {\n                for (p = 0; p < ac->planes; p++)\n                    ac->conv_flat_generic(out->data[p], in->data[p], len);\n            } else {\n                for (p = 0; p < ac->planes; p++)\n                    ac->conv_flat(out->data[p], in->data[p], len);\n            }\n            break;\n        }\n        case CONV_FUNC_TYPE_INTERLEAVE:\n            if (use_generic)\n                ac->conv_interleave_generic(out->data[0], in->data, len,\n                                            ac->channels);\n            else\n                ac->conv_interleave(out->data[0], in->data, len, ac->channels);\n            break;\n        case CONV_FUNC_TYPE_DEINTERLEAVE:\n            if (use_generic)\n                ac->conv_deinterleave_generic(out->data, in->data[0], len,\n                                              ac->channels);\n            else\n                ac->conv_deinterleave(out->data, in->data[0], len,\n                                      ac->channels);\n            break;\n        }\n    }\n    out->nb_samples = in->nb_samples;\n    return 0;\n}', 'int ff_convert_dither(DitherContext *c, AudioData *dst, AudioData *src)\n{\n    int ret;\n    AudioData *flt_data;\n    if (dst->sample_fmt == AV_SAMPLE_FMT_S16P)\n        c->s16_data = dst;\n    else {\n        ret = ff_audio_data_realloc(c->s16_data, src->nb_samples);\n        if (ret < 0)\n            return ret;\n    }\n    if (src->sample_fmt != AV_SAMPLE_FMT_FLTP || c->apply_map) {\n        ret = ff_audio_data_realloc(c->flt_data, src->nb_samples);\n        if (ret < 0)\n            return ret;\n        flt_data = c->flt_data;\n    }\n    if (src->sample_fmt != AV_SAMPLE_FMT_FLTP) {\n        ret = ff_audio_convert(c->ac_in, flt_data, src);\n        if (ret < 0)\n            return ret;\n    } else if (c->apply_map) {\n        ret = ff_audio_data_copy(flt_data, src, c->ch_map_info);\n        if (ret < 0)\n            return ret;\n    } else {\n        flt_data = src;\n    }\n    if (c->method != AV_RESAMPLE_DITHER_TRIANGULAR_NS) {\n        int ptr_align     = FFMIN(flt_data->ptr_align,     c->s16_data->ptr_align);\n        int samples_align = FFMIN(flt_data->samples_align, c->s16_data->samples_align);\n        int aligned_len   = FFALIGN(src->nb_samples, c->ddsp.samples_align);\n        if (!(ptr_align % c->ddsp.ptr_align) && samples_align >= aligned_len) {\n            c->quantize      = c->ddsp.quantize;\n            c->samples_align = c->ddsp.samples_align;\n        } else {\n            c->quantize      = quantize_c;\n            c->samples_align = 1;\n        }\n    }\n    ret = convert_samples(c, (int16_t **)c->s16_data->data,\n                          (float * const *)flt_data->data, src->channels,\n                          src->nb_samples);\n    if (ret < 0)\n        return ret;\n    c->s16_data->nb_samples = src->nb_samples;\n    if (dst->sample_fmt == AV_SAMPLE_FMT_S16) {\n        ret = ff_audio_convert(c->ac_out, dst, c->s16_data);\n        if (ret < 0)\n            return ret;\n    } else\n        c->s16_data = NULL;\n    return 0;\n}', 'int ff_audio_data_realloc(AudioData *a, int nb_samples)\n{\n    int ret, new_buf_size, plane_size, p;\n    if (a->allocated_samples >= nb_samples)\n        return 0;\n    if (a->read_only || !a->allow_realloc)\n        return AVERROR(EINVAL);\n    new_buf_size = av_samples_get_buffer_size(&plane_size,\n                                              a->allocated_channels, nb_samples,\n                                              a->sample_fmt, 0);\n    if (new_buf_size < 0)\n        return new_buf_size;\n    if (a->nb_samples > 0 && a->is_planar) {\n        uint8_t *new_data[AVRESAMPLE_MAX_CHANNELS] = { NULL };\n        ret = av_samples_alloc(new_data, &plane_size, a->allocated_channels,\n                               nb_samples, a->sample_fmt, 0);\n        if (ret < 0)\n            return ret;\n        for (p = 0; p < a->planes; p++)\n            memcpy(new_data[p], a->data[p], a->nb_samples * a->stride);\n        av_freep(&a->buffer);\n        memcpy(a->data, new_data, sizeof(new_data));\n        a->buffer = a->data[0];\n    } else {\n        av_freep(&a->buffer);\n        a->buffer = av_malloc(new_buf_size);\n        if (!a->buffer)\n            return AVERROR(ENOMEM);\n        ret = av_samples_fill_arrays(a->data, &plane_size, a->buffer,\n                                     a->allocated_channels, nb_samples,\n                                     a->sample_fmt, 0);\n        if (ret < 0)\n            return ret;\n    }\n    a->buffer_size       = new_buf_size;\n    a->allocated_samples = nb_samples;\n    calc_ptr_alignment(a);\n    a->samples_align = plane_size / a->stride;\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}']