aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorFilipe Coelho <falktx@falktx.com>2021-03-10 14:00:47 +0000
committerDavid Robillard <d@drobilla.net>2021-03-10 10:06:46 -0500
commit446232eade7b08360fbadf6d16ed7a1ee7481faf (patch)
treea86d00a3a1b2c8709fa8ffb6fe20dcea163b4d0b /plugins
parentdb715453bc12ac1d91183d3bc3642e4055c9aa26 (diff)
downloadlv2-446232eade7b08360fbadf6d16ed7a1ee7481faf.tar.xz
eg-sampler: Fix out of bounds sample read after loading new file
Diffstat (limited to 'plugins')
-rw-r--r--plugins/eg-sampler.lv2/sampler.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/plugins/eg-sampler.lv2/sampler.c b/plugins/eg-sampler.lv2/sampler.c
index 6c64df5..1efad3c 100644
--- a/plugins/eg-sampler.lv2/sampler.c
+++ b/plugins/eg-sampler.lv2/sampler.c
@@ -211,6 +211,10 @@ work_response(LV2_Handle instance, uint32_t size, const void* data)
// Install the new sample
self->sample = *(Sample* const*)data;
+ // Stop playing previous sample, which can be larger than new one
+ self->frame = 0;
+ self->play = false;
+
// Schedule work to free the old sample
SampleMessage msg = {{sizeof(Sample*), self->uris.eg_freeSample}, old_sample};
self->schedule->schedule_work(self->schedule->handle, sizeof(msg), &msg);