From c22f9aecbb83a59a13744c3110e10fd7a6f3db3b Mon Sep 17 00:00:00 2001 From: paul Date: Wed, 2 Mar 2011 13:28:24 +0000 Subject: [PATCH] return null if jack_port_get_buffer() is used before jack_activate() git-svn-id: svn+ssh://jackaudio.org/trunk/jack@4140 0c269be4-1314-0410-8aa9-9f06e86f4224 --- libjack/port.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libjack/port.c b/libjack/port.c index ae442b0..af7d2ae 100644 --- a/libjack/port.c +++ b/libjack/port.c @@ -23,6 +23,7 @@ #include #include +#include #include #include @@ -564,6 +565,10 @@ jack_port_get_buffer (jack_port_t *port, jack_nframes_t nframes) if (port->tied) { return jack_port_get_buffer (port->tied, nframes); } + + if (port->client_segment_base == NULL || *port->client_segment_base == MAP_FAILED) { + return NULL; + } return jack_output_port_buffer (port); } @@ -575,6 +580,10 @@ jack_port_get_buffer (jack_port_t *port, jack_nframes_t nframes) */ if ((node = port->connections) == NULL) { + if (port->client_segment_base == NULL || *port->client_segment_base == MAP_FAILED) { + return NULL; + } + /* no connections; return a zero-filled buffer */ return (void *) (*(port->client_segment_base) + port->type_info->zero_buffer_offset); }