mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-04-30 06:46:49 -04:00
security: clamp channel count in PulseAudio volume control handler
Memory Safety: High The stream_control_info() callback copied control->n_values floats into stream->volume.values without checking bounds. The source allows up to MAX_VALUES (256) entries but the destination volume array is only CHANNELS_MAX (64) entries, so a stream with more than 64 channel volumes would overflow the buffer. Clamp n_values to CHANNELS_MAX before the copy. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
88a3bf8aab
commit
6efaf12d00
1 changed files with 2 additions and 2 deletions
|
|
@ -1121,8 +1121,8 @@ static void stream_control_info(void *data, uint32_t id,
|
|||
switch (id) {
|
||||
case SPA_PROP_channelVolumes:
|
||||
if (!stream->volume_set) {
|
||||
stream->volume.channels = control->n_values;
|
||||
memcpy(stream->volume.values, control->values, control->n_values * sizeof(float));
|
||||
stream->volume.channels = SPA_MIN(control->n_values, CHANNELS_MAX);
|
||||
memcpy(stream->volume.values, control->values, stream->volume.channels * sizeof(float));
|
||||
pw_log_info("stream %p: volume changed %f", stream, stream->volume.values[0]);
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue