wav: Don't assume CHUNK_SIZE >= total_samples

This commit is contained in:
Soeren Apel 2018-06-05 16:53:59 +02:00
parent bf2a6eeaa0
commit 5eb39a91f3
1 changed files with 4 additions and 3 deletions

View File

@ -203,10 +203,11 @@ static void send_chunk(const struct sr_input *in, int offset, int num_samples)
inc = in->priv;
s = in->buf->str + offset;
fdata = g_malloc0(CHUNK_SIZE * sizeof(float));
d = (char *)fdata;
total_samples = num_samples * inc->num_channels;
fdata = g_malloc0(total_samples * sizeof(float));
s = in->buf->str + offset;
d = (char *)fdata;
for (samplenum = 0; samplenum < total_samples; samplenum++) {
if (inc->fmt_code == WAVE_FORMAT_PCM_) {
switch (inc->unitsize) {