Fix assertion failure when reading end of stream

Getting the address of the end of a vector apparently raises an
assertion failure now, even if we didn't do anything with it.
This commit is contained in:
Robbert van der Helm
2021-04-30 17:00:04 +02:00
parent 588a8fd590
commit 89d6c1b2e0
2 changed files with 8 additions and 4 deletions
+2
View File
@@ -73,6 +73,8 @@ Versioning](https://semver.org/spec/v2.0.0.html).
open. open.
- Fixed a regression from yabridge 3.1.0 where REAPER would freeze when opening - Fixed a regression from yabridge 3.1.0 where REAPER would freeze when opening
a VST3 plugin context menu. 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 - _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 the host to always be using Microsoft COM and it won't initialize it by
itself. InfiniStrip loads as expected now. itself. InfiniStrip loads as expected now.
+4 -2
View File
@@ -143,15 +143,17 @@ tresult PLUGIN_API YaBStream::read(void* buffer,
std::min(static_cast<int64_t>(numBytes), std::min(static_cast<int64_t>(numBytes),
static_cast<int64_t>(this->buffer.size()) - seek_position); static_cast<int64_t>(this->buffer.size()) - seek_position);
if (bytes_to_read > 0) {
std::copy_n(&this->buffer[seek_position], bytes_to_read, std::copy_n(&this->buffer[seek_position], bytes_to_read,
reinterpret_cast<uint8_t*>(buffer)); reinterpret_cast<uint8_t*>(buffer));
seek_position += bytes_to_read; seek_position += bytes_to_read;
}
if (numBytesRead) { if (numBytesRead) {
*numBytesRead = static_cast<int32>(bytes_to_read); *numBytesRead = static_cast<int32>(bytes_to_read);
} }
return Steinberg::kResultOk; return bytes_to_read > 0 ? Steinberg::kResultOk : Steinberg::kResultFalse;
} }
tresult PLUGIN_API YaBStream::write(void* buffer, tresult PLUGIN_API YaBStream::write(void* buffer,