mirror of
https://github.com/ericonr/sndio.git
synced 2024-02-18 04:45:21 -06:00
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:
parent
02ff6b20fb
commit
7ddb1a5fe5
@ -532,6 +532,8 @@ slot_mix_badd(struct slot *s, adata_t *odata)
|
|||||||
while (otodo > 0) {
|
while (otodo > 0) {
|
||||||
idata = (adata_t *)abuf_rgetblk(&s->buf, &len);
|
idata = (adata_t *)abuf_rgetblk(&s->buf, &len);
|
||||||
icnt = len / s->bpf;
|
icnt = len / s->bpf;
|
||||||
|
if (icnt > s->round)
|
||||||
|
icnt = s->round;
|
||||||
ocnt = otodo;
|
ocnt = otodo;
|
||||||
slot_getcnt(s, &icnt, &ocnt);
|
slot_getcnt(s, &icnt, &ocnt);
|
||||||
if (icnt == 0)
|
if (icnt == 0)
|
||||||
@ -606,6 +608,8 @@ slot_sub_bcopy(struct slot *s, adata_t *idata, int itodo)
|
|||||||
while (itodo > 0) {
|
while (itodo > 0) {
|
||||||
odata = (adata_t *)abuf_wgetblk(&s->buf, &len);
|
odata = (adata_t *)abuf_wgetblk(&s->buf, &len);
|
||||||
ocnt = len / s->bpf;
|
ocnt = len / s->bpf;
|
||||||
|
if (ocnt > s->round)
|
||||||
|
ocnt = s->round;
|
||||||
icnt = itodo;
|
icnt = itodo;
|
||||||
slot_getcnt(s, &icnt, &ocnt);
|
slot_getcnt(s, &icnt, &ocnt);
|
||||||
if (ocnt == 0)
|
if (ocnt == 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user