mirror of https://github.com/ericonr/sndio.git
Fix off-by-one array access when 64 channel stream is resampled
This commit is contained in:
parent
aac840d9f9
commit
c4b354abd7
|
@ -429,7 +429,7 @@ resamp_do(struct resamp *p, adata_t *in, adata_t *out, int icnt, int ocnt)
|
||||||
if (ofr == 0)
|
if (ofr == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
for (c = nch; c > 0; c--)
|
for (c = 0; c < nch; c++)
|
||||||
f[c] = 0;
|
f[c] = 0;
|
||||||
|
|
||||||
q = diff * p->filt_step;
|
q = diff * p->filt_step;
|
||||||
|
@ -442,7 +442,7 @@ resamp_do(struct resamp *p, adata_t *in, adata_t *out, int icnt, int ocnt)
|
||||||
ds = resamp_filt[qi + 1] - s;
|
ds = resamp_filt[qi + 1] - s;
|
||||||
s += (int64_t)qf * ds >> RESAMP_STEP_BITS;
|
s += (int64_t)qf * ds >> RESAMP_STEP_BITS;
|
||||||
ctx = ctxbuf;
|
ctx = ctxbuf;
|
||||||
for (c = nch; c > 0; c--) {
|
for (c = 0; c < nch; c++) {
|
||||||
f[c] += (int64_t)ctx[n] * s;
|
f[c] += (int64_t)ctx[n] * s;
|
||||||
ctx += RESAMP_NCTX;
|
ctx += RESAMP_NCTX;
|
||||||
}
|
}
|
||||||
|
@ -450,7 +450,7 @@ resamp_do(struct resamp *p, adata_t *in, adata_t *out, int icnt, int ocnt)
|
||||||
n = (n + 1) & (RESAMP_NCTX - 1);
|
n = (n + 1) & (RESAMP_NCTX - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (c = nch; c > 0; c--) {
|
for (c = 0; c < nch; c++) {
|
||||||
s = f[c] >> RESAMP_BITS;
|
s = f[c] >> RESAMP_BITS;
|
||||||
s = (int64_t)s * p->filt_cutoff >> RESAMP_BITS;
|
s = (int64_t)s * p->filt_cutoff >> RESAMP_BITS;
|
||||||
#if ADATA_BITS == 16
|
#if ADATA_BITS == 16
|
||||||
|
|
|
@ -321,7 +321,7 @@ resamp_do(struct resamp *p, adata_t *in, adata_t *out, int todo)
|
||||||
todo--;
|
todo--;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
for (c = nch; c > 0; c--)
|
for (c = 0; c < nch; c++)
|
||||||
f[c] = 0;
|
f[c] = 0;
|
||||||
|
|
||||||
q = diff * p->filt_step;
|
q = diff * p->filt_step;
|
||||||
|
@ -334,7 +334,7 @@ resamp_do(struct resamp *p, adata_t *in, adata_t *out, int todo)
|
||||||
ds = resamp_filt[qi + 1] - s;
|
ds = resamp_filt[qi + 1] - s;
|
||||||
s += (int64_t)qf * ds >> RESAMP_STEP_BITS;
|
s += (int64_t)qf * ds >> RESAMP_STEP_BITS;
|
||||||
ctx = ctxbuf;
|
ctx = ctxbuf;
|
||||||
for (c = nch; c > 0; c--) {
|
for (c = 0; c < nch; c++) {
|
||||||
f[c] += (int64_t)ctx[n] * s;
|
f[c] += (int64_t)ctx[n] * s;
|
||||||
ctx += RESAMP_NCTX;
|
ctx += RESAMP_NCTX;
|
||||||
}
|
}
|
||||||
|
@ -342,7 +342,7 @@ resamp_do(struct resamp *p, adata_t *in, adata_t *out, int todo)
|
||||||
n = (n + 1) & (RESAMP_NCTX - 1);
|
n = (n + 1) & (RESAMP_NCTX - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (c = nch; c > 0; c--) {
|
for (c = 0; c < nch; c++) {
|
||||||
s = f[c] >> RESAMP_BITS;
|
s = f[c] >> RESAMP_BITS;
|
||||||
s = (int64_t)s * p->filt_cutoff >> RESAMP_BITS;
|
s = (int64_t)s * p->filt_cutoff >> RESAMP_BITS;
|
||||||
#if ADATA_BITS == 16
|
#if ADATA_BITS == 16
|
||||||
|
|
Loading…
Reference in New Issue