mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-06 13:30:01 -05:00
filter-chain: do some checks on the number of ports
Try to check that we don't overflow our port arrays.
This commit is contained in:
parent
5c44c6cd5c
commit
168511c157
1 changed files with 24 additions and 0 deletions
|
|
@ -835,20 +835,44 @@ static struct descriptor *descriptor_load(struct impl *impl, const char *type,
|
||||||
if (FC_IS_PORT_INPUT(fp->flags)) {
|
if (FC_IS_PORT_INPUT(fp->flags)) {
|
||||||
pw_log_info("using port %lu ('%s') as input %d", p,
|
pw_log_info("using port %lu ('%s') as input %d", p,
|
||||||
fp->name, desc->n_input);
|
fp->name, desc->n_input);
|
||||||
|
if (desc->n_input >= MAX_PORTS) {
|
||||||
|
pw_log_error("plugin has too many input ports %d >= %d",
|
||||||
|
desc->n_input, MAX_PORTS);
|
||||||
|
res = -ENOTSUP;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
desc->input[desc->n_input++] = p;
|
desc->input[desc->n_input++] = p;
|
||||||
}
|
}
|
||||||
else if (FC_IS_PORT_OUTPUT(fp->flags)) {
|
else if (FC_IS_PORT_OUTPUT(fp->flags)) {
|
||||||
|
if (desc->n_output >= MAX_PORTS) {
|
||||||
|
pw_log_error("plugin has too many output ports %d >= %d",
|
||||||
|
desc->n_output, MAX_PORTS);
|
||||||
|
res = -ENOTSUP;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
pw_log_info("using port %lu ('%s') as output %d", p,
|
pw_log_info("using port %lu ('%s') as output %d", p,
|
||||||
fp->name, desc->n_output);
|
fp->name, desc->n_output);
|
||||||
desc->output[desc->n_output++] = p;
|
desc->output[desc->n_output++] = p;
|
||||||
}
|
}
|
||||||
} else if (FC_IS_PORT_CONTROL(fp->flags)) {
|
} else if (FC_IS_PORT_CONTROL(fp->flags)) {
|
||||||
if (FC_IS_PORT_INPUT(fp->flags)) {
|
if (FC_IS_PORT_INPUT(fp->flags)) {
|
||||||
|
if (desc->n_control >= MAX_CONTROLS) {
|
||||||
|
pw_log_error("plugin has too many control ports %d >= %d",
|
||||||
|
desc->n_control, MAX_CONTROLS);
|
||||||
|
res = -ENOTSUP;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
pw_log_info("using port %lu ('%s') as control %d", p,
|
pw_log_info("using port %lu ('%s') as control %d", p,
|
||||||
fp->name, desc->n_control);
|
fp->name, desc->n_control);
|
||||||
desc->control[desc->n_control++] = p;
|
desc->control[desc->n_control++] = p;
|
||||||
}
|
}
|
||||||
else if (FC_IS_PORT_OUTPUT(fp->flags)) {
|
else if (FC_IS_PORT_OUTPUT(fp->flags)) {
|
||||||
|
if (desc->n_notify >= MAX_CONTROLS) {
|
||||||
|
pw_log_error("plugin has too many notify ports %d >= %d",
|
||||||
|
desc->n_notify, MAX_CONTROLS);
|
||||||
|
res = -ENOTSUP;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
pw_log_info("using port %lu ('%s') as notify %d", p,
|
pw_log_info("using port %lu ('%s') as notify %d", p,
|
||||||
fp->name, desc->n_notify);
|
fp->name, desc->n_notify);
|
||||||
desc->notify[desc->n_notify++] = p;
|
desc->notify[desc->n_notify++] = p;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue