VST3: handle zero length plugin state

This commit is contained in:
Robin Gareus 2020-09-30 04:41:59 +02:00
parent 5e882afe10
commit 8209b4b948
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04

View file

@ -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);
}