aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2013-06-08 18:13:38 +0000
committerDavid Robillard <d@drobilla.net>2013-06-08 18:13:38 +0000
commitb5ff339e2c3dfc8ad4d73c21b6887a58a6c71c9d (patch)
treebc17c25da770a6ede18af63a91b786de9907f72f
parent3501582c83f9abe27cc23a6a0526d1ddfa4138d9 (diff)
downloadjalv-b5ff339e2c3dfc8ad4d73c21b6887a58a6c71c9d.tar.gz
jalv-b5ff339e2c3dfc8ad4d73c21b6887a58a6c71c9d.tar.bz2
jalv-b5ff339e2c3dfc8ad4d73c21b6887a58a6c71c9d.zip
Fix potential ringbuffer race for UI events.
git-svn-id: http://svn.drobilla.net/lad/trunk/jalv@5124 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--src/jalv.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/jalv.c b/src/jalv.c
index 946f98e..f174eb1 100644
--- a/src/jalv.c
+++ b/src/jalv.c
@@ -746,7 +746,9 @@ jalv_emit_ui_events(Jalv* jalv)
{
ControlChange ev;
const size_t space = jack_ringbuffer_read_space(jalv->plugin_events);
- for (size_t i = 0; i < space; i += sizeof(ev) + ev.size) {
+ for (size_t i = 0;
+ i + sizeof(ev) + sizeof(float) <= space;
+ i += sizeof(ev) + ev.size) {
// Read event header to get the size
jack_ringbuffer_read(jalv->plugin_events, (char*)&ev, sizeof(ev));