mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
filter-chain: protect against bad values
This commit is contained in:
parent
755eab0cd3
commit
ce2b385318
1 changed files with 8 additions and 2 deletions
|
|
@ -457,11 +457,16 @@ static void * convolver_instantiate(const struct fc_descriptor * Descriptor,
|
||||||
|
|
||||||
impl->rate = SampleRate;
|
impl->rate = SampleRate;
|
||||||
|
|
||||||
if (length == 0)
|
if (delay < 0)
|
||||||
|
delay = 0;
|
||||||
|
|
||||||
|
if (length <= 0)
|
||||||
length = info.frames;
|
length = info.frames;
|
||||||
else
|
else
|
||||||
length = SPA_MIN(length, info.frames);
|
length = SPA_MIN(length, info.frames);
|
||||||
|
|
||||||
|
if (offset < 0)
|
||||||
|
offset = 0;
|
||||||
length -= SPA_MIN(offset, length);
|
length -= SPA_MIN(offset, length);
|
||||||
|
|
||||||
n_frames = delay + length;
|
n_frames = delay + length;
|
||||||
|
|
@ -473,7 +478,8 @@ static void * convolver_instantiate(const struct fc_descriptor * Descriptor,
|
||||||
if (samples == NULL)
|
if (samples == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
sf_seek(f, offset, SEEK_SET);
|
if (offset > 0)
|
||||||
|
sf_seek(f, offset, SEEK_SET);
|
||||||
sf_readf_float(f, samples + (delay * info.channels), length);
|
sf_readf_float(f, samples + (delay * info.channels), length);
|
||||||
|
|
||||||
channel = channel % info.channels;
|
channel = channel % info.channels;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue