mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-06-15 16:03:55 +02:00
Fix segfault in REAPER due to new vendor extension
This `effVendorSpecific` call would pass a non-zero non-pointer value to the pointer argument, which would then of course result in segfaults.
This commit is contained in:
@@ -17,6 +17,12 @@ Versioning](https://semver.org/spec/v2.0.0.html).
|
|||||||
yabridge now includes a small workaround to make sure that the affected code
|
yabridge now includes a small workaround to make sure that the affected code
|
||||||
never gets compiled.
|
never gets compiled.
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Added a workaround for **REAPER** using a new vendor-specific VST2.4 extension
|
||||||
|
that passes a non-pointer value to a pointer parameter. This would cause
|
||||||
|
segfaults with some plugins.
|
||||||
|
|
||||||
## [3.0.0] - 2021-02-14
|
## [3.0.0] - 2021-02-14
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
@@ -16,21 +16,27 @@
|
|||||||
|
|
||||||
#include "vst2.h"
|
#include "vst2.h"
|
||||||
|
|
||||||
EventPayload DefaultDataConverter::read(const int /*opcode*/,
|
EventPayload DefaultDataConverter::read(const int opcode,
|
||||||
const int /*index*/,
|
const int index,
|
||||||
const intptr_t /*value*/,
|
const intptr_t /*value*/,
|
||||||
const void* data) const {
|
const void* data) const {
|
||||||
|
// HACK: REAPER has recently started using `effVendorSpecific` with a
|
||||||
|
// non-pointer `data` argument, so we need to explicitly handle this
|
||||||
|
if (opcode == effVendorSpecific && index == effSetSpeakerArrangement) {
|
||||||
|
return static_cast<native_size_t>(reinterpret_cast<size_t>(data));
|
||||||
|
}
|
||||||
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is a simple fallback that will work in almost every case.
|
// This is a simple fallback that will work in almost every case. Because
|
||||||
// Because some plugins don't zero out their string buffers when sending
|
// some plugins don't zero out their string buffers when sending host
|
||||||
// host callbacks, we will explicitely list all callbacks that expect a
|
// callbacks, we will explicitely list all callbacks that expect a string in
|
||||||
// string in `DispatchDataConverter` adn `HostCallbackDataConverter`.
|
// `DispatchDataConverter` and `HostCallbackDataConverter`.
|
||||||
const char* c_string = static_cast<const char*>(data);
|
const char* str = static_cast<const char*>(data);
|
||||||
if (c_string[0] != 0) {
|
if (str[0] != 0) {
|
||||||
return std::string(c_string);
|
return std::string(str);
|
||||||
} else {
|
} else {
|
||||||
return WantsString{};
|
return WantsString{};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -156,6 +156,9 @@ std::optional<std::string> opcode_to_string(bool is_dispatch, int opcode) {
|
|||||||
case effGetSpeakerArrangement:
|
case effGetSpeakerArrangement:
|
||||||
return "effGetSpeakerArrangement";
|
return "effGetSpeakerArrangement";
|
||||||
break;
|
break;
|
||||||
|
case effVendorSpecific:
|
||||||
|
return "effVendorSpecific";
|
||||||
|
break;
|
||||||
case effGetTailSize:
|
case effGetTailSize:
|
||||||
return "effGetTailSize";
|
return "effGetTailSize";
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -47,6 +47,14 @@
|
|||||||
[[maybe_unused]] constexpr int effSetSpeakerArrangement = 42;
|
[[maybe_unused]] constexpr int effSetSpeakerArrangement = 42;
|
||||||
[[maybe_unused]] constexpr int effGetSpeakerArrangement = 69;
|
[[maybe_unused]] constexpr int effGetSpeakerArrangement = 69;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used by REAPER for some VST2.4 extensions. Most of the arguments passed to
|
||||||
|
* this will be able to be handled automatically by our `DefaultDataConverter`.
|
||||||
|
* We need one special case because for when they're now using the `data`
|
||||||
|
* argument with a non-pointer value. Found on the same list as above.
|
||||||
|
*/
|
||||||
|
[[maybe_unused]] constexpr int effVendorSpecific = 50;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used by hosts to query the length of reverb tails (equivalent to
|
* Used by hosts to query the length of reverb tails (equivalent to
|
||||||
* `IAudioProcessor::getTailSamples`). Found on the same list as above.
|
* `IAudioProcessor::getTailSamples`). Found on the same list as above.
|
||||||
|
|||||||
Reference in New Issue
Block a user