diff --git a/CHANGELOG.md b/CHANGELOG.md index 48002192..0cc3412f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -73,6 +73,8 @@ Versioning](https://semver.org/spec/v2.0.0.html). open. - Fixed a regression from yabridge 3.1.0 where REAPER would freeze when opening a VST3 plugin context menu. +- Fixed a potential assertion failure when setting VST3 preset data. This would + depend on the `libstdc++` version used to built yabridge with. - _PSPaudioware InifniStrip_ would fail to initialize because the plugin expects the host to always be using Microsoft COM and it won't initialize it by itself. InfiniStrip loads as expected now. diff --git a/src/common/serialization/vst3/bstream.cpp b/src/common/serialization/vst3/bstream.cpp index e48514c5..02dcdb3f 100644 --- a/src/common/serialization/vst3/bstream.cpp +++ b/src/common/serialization/vst3/bstream.cpp @@ -143,15 +143,17 @@ tresult PLUGIN_API YaBStream::read(void* buffer, std::min(static_cast(numBytes), static_cast(this->buffer.size()) - seek_position); - std::copy_n(&this->buffer[seek_position], bytes_to_read, - reinterpret_cast(buffer)); + if (bytes_to_read > 0) { + std::copy_n(&this->buffer[seek_position], bytes_to_read, + reinterpret_cast(buffer)); + seek_position += bytes_to_read; + } - seek_position += bytes_to_read; if (numBytesRead) { *numBytesRead = static_cast(bytes_to_read); } - return Steinberg::kResultOk; + return bytes_to_read > 0 ? Steinberg::kResultOk : Steinberg::kResultFalse; } tresult PLUGIN_API YaBStream::write(void* buffer,