If there is no silence memblock and no data, pa_memblockq_peek can
return NULL. In this case, do not crash on an assertion in
pa_memblock_acquire, but instead return NULL.

BugLink: http://bugs.launchpad.net/bugs/1058200
Signed-off-by: David Henningsson <[email protected]>
---
 src/pulse/stream.c |    3 ++-
 src/pulse/stream.h |    4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/pulse/stream.c b/src/pulse/stream.c
index 2b6d306..0defb4f 100644
--- a/src/pulse/stream.c
+++ b/src/pulse/stream.c
@@ -1592,7 +1592,8 @@ int pa_stream_peek(pa_stream *s, const void **data, 
size_t *length) {
 
     if (!s->peek_memchunk.memblock) {
 
-        if (pa_memblockq_peek(s->record_memblockq, &s->peek_memchunk) < 0) {
+        if (pa_memblockq_peek(s->record_memblockq, &s->peek_memchunk) < 0 ||
+            !s->peek_memchunk.memblock) {
             *data = NULL;
             *length = 0;
             return 0;
diff --git a/src/pulse/stream.h b/src/pulse/stream.h
index b4464fa..8665d13 100644
--- a/src/pulse/stream.h
+++ b/src/pulse/stream.h
@@ -537,8 +537,8 @@ int pa_stream_write(
  * \a data will point to the actual data and \a nbytes will contain the size
  * of the data in bytes (which can be less or more than a complete
  * fragment). Use pa_stream_drop() to actually remove the data from
- * the buffer. If no data is available this will return a NULL
- * pointer. */
+ * the buffer. If no data is available (at the current read position)
+ * this will return a NULL pointer. */
 int pa_stream_peek(
         pa_stream *p                 /**< The stream to use */,
         const void **data            /**< Pointer to pointer that will point 
to data */,
-- 
1.7.9.5

-- 
You received this bug notification because you are a member of Desktop
Packages, which is subscribed to pulseaudio in Ubuntu.
https://bugs.launchpad.net/bugs/1058200

Title:
  [sound]: gnome-control-center crashed with SIGABRT in
  pa_memblock_acquire()

Status in “pulseaudio” package in Ubuntu:
  In Progress

Bug description:
  The Sound panel has been extremely crash-prone for the past oh, maybe
  2 weeks.

  ProblemType: Crash
  DistroRelease: Ubuntu 12.10
  Package: gnome-control-center 1:3.4.2-0ubuntu15
  ProcVersionSignature: Ubuntu 3.5.0-15.23-generic 3.5.4
  Uname: Linux 3.5.0-15-generic x86_64
  ApportVersion: 2.5.2-0ubuntu4
  Architecture: amd64
  CrashCounter: 1
  Date: Wed Sep 26 15:34:20 2012
  ExecutablePath: /usr/bin/gnome-control-center
  ProcCmdline: gnome-control-center --overview
  Signal: 6
  SourcePackage: gnome-control-center
  StacktraceTop:
   raise () from /lib/x86_64-linux-gnu/libc.so.6
   abort () from /lib/x86_64-linux-gnu/libc.so.6
   pa_memblock_acquire () from 
/usr/lib/x86_64-linux-gnu/pulseaudio/libpulsecommon-2.1.so
   pa_stream_peek () from /usr/lib/x86_64-linux-gnu/libpulse.so.0
   ?? () from /usr/lib/control-center-1/panels/libsound.so
  Title: [sound]: gnome-control-center crashed with SIGABRT in raise()
  UpgradeStatus: No upgrade log present (probably fresh install)
  UserGroups: adm cdrom dip libvirtd lpadmin plugdev sambashare sbuild sudo
  usr_lib_gnome-control-center:
   activity-log-manager-control-center 0.9.4-0ubuntu3
   deja-dup                            23.92-0ubuntu1
   gnome-control-center-signon         0.0.17-0ubuntu1
   indicator-datetime                  12.10.1-0ubuntu1

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/1058200/+subscriptions

-- 
Mailing list: https://launchpad.net/~desktop-packages
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~desktop-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to