Don't rely on the resampling code to calculate the number of samples

to process, as it may produce one extra sample (to handle accumulation
of fractional samples), which would cause access to one sample past
the end of the buffer and crash aucat. Fix this by limiting the number
of samples processed to a single block.

Found by and help from Michael W. Bombardieri <mb at ii.net>. Thanks.
This commit is contained in:
Alexandre Ratchov 2016-09-27 09:01:21 +02:00
parent 02ff6b20fb
commit 7ddb1a5fe5
1 changed files with 4 additions and 0 deletions

View File

@ -532,6 +532,8 @@ slot_mix_badd(struct slot *s, adata_t *odata)
while (otodo > 0) {
idata = (adata_t *)abuf_rgetblk(&s->buf, &len);
icnt = len / s->bpf;
if (icnt > s->round)
icnt = s->round;
ocnt = otodo;
slot_getcnt(s, &icnt, &ocnt);
if (icnt == 0)
@ -606,6 +608,8 @@ slot_sub_bcopy(struct slot *s, adata_t *idata, int itodo)
while (itodo > 0) {
odata = (adata_t *)abuf_wgetblk(&s->buf, &len);
ocnt = len / s->bpf;
if (ocnt > s->round)
ocnt = s->round;
icnt = itodo;
slot_getcnt(s, &icnt, &ocnt);
if (ocnt == 0)