mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
audioconvert: avoid crash on 64 channels + monitor enabled
this->monitor enabled adds an additional port in reconfigure_mode. If there was already the maximum 64, this will crash. Make maximum number of ports one larger than max channels to avoid problems.
This commit is contained in:
parent
0f62d3442c
commit
6bfe9a362c
2 changed files with 5 additions and 3 deletions
|
|
@ -60,7 +60,7 @@ static struct spa_log_topic *log_topic = &SPA_LOG_TOPIC(0, "spa.audioconvert");
|
|||
#define MAX_ALIGN FMT_OPS_MAX_ALIGN
|
||||
#define MAX_BUFFERS 32
|
||||
#define MAX_DATAS SPA_AUDIO_MAX_CHANNELS
|
||||
#define MAX_PORTS SPA_AUDIO_MAX_CHANNELS
|
||||
#define MAX_PORTS (SPA_AUDIO_MAX_CHANNELS+1)
|
||||
|
||||
#define DEFAULT_MUTE false
|
||||
#define DEFAULT_VOLUME VOLUME_NORM
|
||||
|
|
@ -299,6 +299,8 @@ static int init_port(struct impl *this, enum spa_direction direction, uint32_t p
|
|||
struct port *port = GET_PORT(this, direction, port_id);
|
||||
const char *name;
|
||||
|
||||
spa_assert(port_id < MAX_PORTS);
|
||||
|
||||
if (port == NULL) {
|
||||
port = calloc(1, sizeof(struct port));
|
||||
if (port == NULL)
|
||||
|
|
@ -1547,7 +1549,7 @@ static int port_enum_formats(void *object,
|
|||
SPA_FORMAT_AUDIO_rate, SPA_POD_CHOICE_RANGE_Int(
|
||||
rate, 1, INT32_MAX),
|
||||
SPA_FORMAT_AUDIO_channels, SPA_POD_CHOICE_RANGE_Int(
|
||||
DEFAULT_CHANNELS, 1, MAX_PORTS));
|
||||
DEFAULT_CHANNELS, 1, SPA_AUDIO_MAX_CHANNELS));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ SPA_LOG_IMPL(logger);
|
|||
|
||||
extern const struct spa_handle_factory test_source_factory;
|
||||
|
||||
#define MAX_PORTS SPA_AUDIO_MAX_CHANNELS
|
||||
#define MAX_PORTS (SPA_AUDIO_MAX_CHANNELS+1)
|
||||
|
||||
struct context {
|
||||
struct spa_handle *convert_handle;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue