security: validate sample rate in PulseAudio update_stream_sample_rate

The client-provided rate was used without validation. A zero or
excessively large rate produces extreme correction values passed
to pw_stream_set_control. Reject rates that are zero or exceed
RATE_MAX.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Wim Taymans 2026-04-29 16:50:43 +02:00
parent 5f02641859
commit cd7bb1e37d

View file

@ -4684,6 +4684,9 @@ static int do_update_stream_sample_rate(struct client *client, uint32_t command,
if (stream == NULL || stream->type == STREAM_TYPE_UPLOAD)
return -ENOENT;
if (rate == 0 || rate > RATE_MAX)
return -EINVAL;
stream->rate = rate;
corr = (float)rate/(float)stream->ss.rate;