[pulseaudio-commits] 4 commits - configure.ac src/pulse src/pulsecore

David Henningsson diwic at kemper.freedesktop.org
Fri Oct 24 06:04:10 PDT 2014


 configure.ac                    |    1 -
 src/pulse/stream.c              |    2 ++
 src/pulsecore/memblockq.c       |    3 ++-
 src/pulsecore/protocol-native.c |    7 +++++++
 4 files changed, 11 insertions(+), 2 deletions(-)

New commits:
commit e728bcf614924bfa37627653c32ac3ae4d604d4e
Author: David Henningsson <david.henningsson at canonical.com>
Date:   Wed Oct 15 09:10:02 2014 +0200

    configure: Remove "WIBBLE" test
    
    Apparently "WIBBLE" is just a test, and maybe the test was "How
    long does it take until somebody notices a strange row in configure.ac
    and tries to remove it", if so, the test result is "a little over
    three years". :-)
    
    Signed-off-by: David Henningsson <david.henningsson at canonical.com>

diff --git a/configure.ac b/configure.ac
index 74bea71..f426e03 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1334,7 +1334,6 @@ AC_ARG_ENABLE([legacy-database-entry-format],
 if test "x$enable_legacy_database_entry_format" != "xno" ; then
         AC_DEFINE(ENABLE_LEGACY_DATABASE_ENTRY_FORMAT, [1], [Legacy database entry format])
 fi
-AC_DEFINE([WIBBLE], 1, [Just a test.])
 
 AC_ARG_ENABLE([static-bins],
     AS_HELP_STRING([--enable-static-bins],[Statically link executables.]))

commit 22827a5e1e627115ae44a297be2ba5b35561700f
Author: David Henningsson <david.henningsson at canonical.com>
Date:   Thu Oct 16 11:41:19 2014 +0200

    protocol-native: Fail if trying to push unaligned memblock into queue
    
    We will just ignore the memblock if this happens. We already have
    a check for this in the client library, so this one is just for
    security reasons.
    
    Signed-off-by: David Henningsson <david.henningsson at canonical.com>

diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c
index 6ec65d6..2ef1854 100644
--- a/src/pulsecore/protocol-native.c
+++ b/src/pulsecore/protocol-native.c
@@ -4922,6 +4922,13 @@ static void pstream_memblock_callback(pa_pstream *p, uint32_t channel, int64_t o
     if (playback_stream_isinstance(stream)) {
         playback_stream *ps = PLAYBACK_STREAM(stream);
 
+        size_t frame_size = pa_frame_size(&ps->sink_input->sample_spec);
+        if (chunk->index % frame_size != 0 || chunk->length % frame_size != 0) {
+            pa_log_warn("Client sent non-aligned memblock: index %d, length %d, frame size: %d",
+                        (int) chunk->index, (int) chunk->length, (int) frame_size);
+            return;
+        }
+
         pa_atomic_inc(&ps->seek_or_post_in_queue);
         if (chunk->memblock) {
             if (seek != PA_SEEK_RELATIVE || offset != 0)

commit 150ace90f3808bbb7240e18a11140d66a7bda146
Author: David Henningsson <david.henningsson at canonical.com>
Date:   Thu Oct 16 11:41:18 2014 +0200

    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 at canonical.com>

diff --git a/src/pulse/stream.c b/src/pulse/stream.c
index 3c04c42..f549036 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) {

commit 6434853b0449c6adf6a8b16905188928b495a006
Author: David Henningsson <david.henningsson at canonical.com>
Date:   Thu Oct 16 11:41:17 2014 +0200

    memblockq: Do not allow non-frame indices in the memblock queue
    
    Since we don't allow lengths that are not frame aligned,
    it does not make sense to allow indices that are not frame aligned
    either.
    Also, allowing such a thing to be added causes the daemon to crash
    later instead (see https://bugs.freedesktop.org/show_bug.cgi?id=77595 ).
    
    Also drop _se from assert (there is no side effect).
    
    Signed-off-by: David Henningsson <david.henningsson at canonical.com>

diff --git a/src/pulsecore/memblockq.c b/src/pulsecore/memblockq.c
index 571107d..16a62da 100644
--- a/src/pulsecore/memblockq.c
+++ b/src/pulsecore/memblockq.c
@@ -287,7 +287,8 @@ int pa_memblockq_push(pa_memblockq* bq, const pa_memchunk *uchunk) {
     pa_assert(uchunk->length > 0);
     pa_assert(uchunk->index + uchunk->length <= pa_memblock_get_length(uchunk->memblock));
 
-    pa_assert_se(uchunk->length % bq->base == 0);
+    pa_assert(uchunk->length % bq->base == 0);
+    pa_assert(uchunk->index % bq->base == 0);
 
     if (!can_push(bq, uchunk->length))
         return -1;



More information about the pulseaudio-commits mailing list