pulse-server: avoid overflow

Make sure the requested bytes never go below 0.

See #1258
This commit is contained in:
Wim Taymans 2021-06-04 09:07:24 +02:00
parent e65afe8fa2
commit 2a8b7594bc

View file

@ -5518,7 +5518,7 @@ static int handle_memblock(struct client *client, struct message *msg)
SPA_MIN(msg->length, stream->attr.maxlength)); SPA_MIN(msg->length, stream->attr.maxlength));
stream->write_index = index + msg->length; stream->write_index = index + msg->length;
spa_ringbuffer_write_update(&stream->ring, stream->write_index); spa_ringbuffer_write_update(&stream->ring, stream->write_index);
stream->requested -= msg->length; stream->requested -= SPA_MIN(msg->length, stream->requested);
finish: finish:
message_free(impl, msg, false, false); message_free(impl, msg, false, false);
return res; return res;