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 <david.henningsson@canonical.com>
This commit is contained in:
David Henningsson 2014-10-16 11:41:18 +02:00
parent 6434853b04
commit 150ace90f3

View file

@ -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) {