From: Soeren Apel Date: Tue, 5 Jun 2018 14:53:59 +0000 (+0200) Subject: wav: Don't assume CHUNK_SIZE >= total_samples X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=5eb39a91f3bb431efcc36f5457be79a1e6239297;p=libsigrok.git wav: Don't assume CHUNK_SIZE >= total_samples --- diff --git a/src/input/wav.c b/src/input/wav.c index b11dcc48..66dfce98 100644 --- a/src/input/wav.c +++ b/src/input/wav.c @@ -203,10 +203,11 @@ static void send_chunk(const struct sr_input *in, int offset, int num_samples) inc = in->priv; + total_samples = num_samples * inc->num_channels; + fdata = g_malloc0(total_samples * sizeof(float)); s = in->buf->str + offset; - fdata = g_malloc0(CHUNK_SIZE * sizeof(float)); d = (char *)fdata; - total_samples = num_samples * inc->num_channels; + for (samplenum = 0; samplenum < total_samples; samplenum++) { if (inc->fmt_code == WAVE_FORMAT_PCM_) { switch (inc->unitsize) {