From 8209b4b9487ac40bbd3a82695d83c2561d1f3a6c Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 30 Sep 2020 04:41:59 +0200 Subject: [PATCH] VST3: handle zero length plugin state --- libs/ardour/vst3_host.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/ardour/vst3_host.cc b/libs/ardour/vst3_host.cc index cd9c085cda..8b1c807269 100644 --- a/libs/ardour/vst3_host.cc +++ b/libs/ardour/vst3_host.cc @@ -474,7 +474,7 @@ RAMStream::RAMStream (uint8_t* data, size_t size) , _pos (0) , _readonly (true) { - if (reallocate_buffer (_size, true)) { + if (size > 0 && reallocate_buffer (_size, true)) { memcpy (_data, data, _size); } else { _size = 0; @@ -494,7 +494,7 @@ RAMStream::RAMStream (std::string const& fn) if (!g_file_get_contents (fn.c_str (), &buf, &length, NULL)) { return; } - if (reallocate_buffer (length, true)) { + if (length > 0 && reallocate_buffer (length, true)) { _size = length; memcpy (_data, buf, _size); }