security: fix NULL dereference in PulseAudio handle_memblock

A client can send memblock data to a playback stream channel before
format negotiation completes and the stream buffer is allocated,
causing a NULL pointer dereference crash. Reject memblock data for
streams that are still being created (create_tag != SPA_ID_INVALID).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Wim Taymans 2026-04-29 16:12:49 +02:00
parent 808bcf39cd
commit a2de6c886e

View file

@ -128,7 +128,8 @@ static int handle_memblock(struct client *client, struct message *msg)
client, channel, offset, flags, msg->length);
stream = pw_map_lookup(&client->streams, channel);
if (stream == NULL || stream->type == STREAM_TYPE_RECORD) {
if (stream == NULL || stream->type == STREAM_TYPE_RECORD ||
stream->create_tag != SPA_ID_INVALID) {
pw_log_info("client %p [%s]: received memblock for unknown channel %d",
client, client->name, channel);
goto finish;