diff options
author | Daryl Poe <daryl.poe@hp.com> | 2013-07-26 13:54:20 -0600 |
---|---|---|
committer | Daryl Poe <daryl.poe@hp.com> | 2013-07-26 13:54:20 -0600 |
commit | be5167654153cad02f821decc39ad35cd239a6ed (patch) | |
tree | 8e78e7ec0426b79d6461aff5cec0c76d8ff8f38e /channels | |
parent | 46a691db029912e5814b0c6fb36002a41e597825 (diff) | |
download | freerdp-be5167654153cad02f821decc39ad35cd239a6ed.tar.gz freerdp-be5167654153cad02f821decc39ad35cd239a6ed.tar.bz2 freerdp-be5167654153cad02f821decc39ad35cd239a6ed.zip |
fix segfault due to pulse input race condition
Diffstat (limited to 'channels')
-rw-r--r-- | channels/audin/client/pulse/audin_pulse.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/channels/audin/client/pulse/audin_pulse.c b/channels/audin/client/pulse/audin_pulse.c index 2d4906ea2..787f208bd 100644 --- a/channels/audin/client/pulse/audin_pulse.c +++ b/channels/audin/client/pulse/audin_pulse.c @@ -290,6 +290,17 @@ static void audin_pulse_stream_request_callback(pa_stream* stream, size_t length BYTE* encoded_data; AudinPulseDevice* pulse = (AudinPulseDevice*) userdata; + /* There is a race condition here where we may receive this callback + * before the buffer has been set up in the main code. It's probably + * possible to fix with additional locking, but it's easier just to + * ignore input until the buffer is ready. + */ + if (pulse->buffer == NULL) + { + /* fprintf(stderr, "%s: ignoring input, pulse buffer not ready.\n", __func__); */ + return; + } + pa_stream_peek(stream, &data, &length); frames = length / pulse->bytes_per_frame; @@ -373,6 +384,7 @@ static void audin_pulse_open(IAudinDevice* device, AudinReceive receive, void* u DEBUG_DVC(""); + pulse->buffer = NULL; pulse->receive = receive; pulse->user_data = user_data; |