From 150ace90f3808bbb7240e18a11140d66a7bda146 Mon Sep 17 00:00:00 2001 From: David Henningsson Date: Thu, 16 Oct 2014 11:41:18 +0200 Subject: [PATCH] stream: Fail on client submitting non-frame-aligned memblocks If somebody tries to push a non-frame-aligned memblock onto the memblockq, then we should fail the write. Otherwise the daemon will crash, see https://bugs.freedesktop.org/show_bug.cgi?id=77595 Signed-off-by: David Henningsson --- src/pulse/stream.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pulse/stream.c b/src/pulse/stream.c index 3c04c427d..f549036f8 100644 --- a/src/pulse/stream.c +++ b/src/pulse/stream.c @@ -1487,6 +1487,8 @@ int pa_stream_write_ext_free( ((data >= s->write_data) && ((const char*) data + length <= (const char*) s->write_data + pa_memblock_get_length(s->write_memblock))), PA_ERR_INVALID); + PA_CHECK_VALIDITY(s->context, offset % pa_frame_size(&s->sample_spec) == 0, PA_ERR_INVALID); + PA_CHECK_VALIDITY(s->context, length % pa_frame_size(&s->sample_spec) == 0, PA_ERR_INVALID); PA_CHECK_VALIDITY(s->context, !free_cb || !s->write_memblock, PA_ERR_INVALID); if (s->write_memblock) {