From 3e71fc19b85853245fd49c6cbef5c8d7f01c03c1 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Sun, 25 Apr 2021 22:43:45 +0200 Subject: [PATCH] Explicitly handle VST2 callbacks with nullptrs This is probably not needed, but we'll do it just in case another plugin does something similar. --- CHANGELOG.md | 8 +++++++- src/wine-host/bridges/vst2.cpp | 28 ++++++++++++++++++++++++---- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 53bc77ca..5975e71c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,12 @@ Versioning](https://semver.org/spec/v2.0.0.html). - When building the package from source, the targetted Wine version gets printed at configure-time. This can make it a bit easier to diagnose Wine-related compilation issues. +- Yabridge automatically handles most common VST2 functions by simply inspecting + the argument types. This works practically everywhere, but Plugsound Free by + UVI would pass unreadable function arguments to functions that are not + supposed to have any arguments, causing yabridge to crash. To prevent similar + situations from happening in the future, yabridge now specifically handles + most common VST2 functions that don't have a data argument. ### Fixed @@ -22,7 +28,7 @@ Versioning](https://semver.org/spec/v2.0.0.html). - Prevent _Native Instruments' FM7_ from crashing when processing MIDI. As a fix, MIDI events are now deallocated later then when they normally would have to be. -- Prevent _Plugsound Free_ by UVI from crashing during initialization. +- Fixed _UVI Plugsound Free_ crashing during initialization. ## [3.1.0] - 2021-04-15 diff --git a/src/wine-host/bridges/vst2.cpp b/src/wine-host/bridges/vst2.cpp index eb18770a..fce27222 100644 --- a/src/wine-host/bridges/vst2.cpp +++ b/src/wine-host/bridges/vst2.cpp @@ -490,13 +490,33 @@ class HostCallbackDataConverter : DefaultDataConverter { case audioMasterGetProductString: return WantsString{}; break; - // HACK: DefaultDataConverter::read() should be able to handle all + // NOTE: DefaultDataConverter::read() should be able to handle all // of these 'simple' opcodes, but Plugsound Free by UVI passes - // random garbage for their data argument, which we would then - // try to read as a string resulting in a memory error. + // random garbage for their data argument. Because of that + // `audioMasterWantMidi()` will segfault because when we'll + // try to read that data as a string we'll start reading + // unallocated memory. Even though no other plugins seem to do + // this< we'll list all of these data-less opcodes just to be + // sure. We're leaving out a few opcodes here, because I have + // no clue whether some of the more obscure ones are supposed + // to have an data argument or not. + case audioMasterAutomate: + case audioMasterVersion: + case audioMasterCurrentId: + case audioMasterIdle: + case audioMasterWantMidi: + case audioMasterSizeWindow: case audioMasterGetSampleRate: case audioMasterGetBlockSize: - case audioMasterWantMidi: + case audioMasterGetInputLatency: + case audioMasterGetOutputLatency: + case audioMasterGetCurrentProcessLevel: + case audioMasterGetAutomationState: + case audioMasterGetVendorVersion: + case audioMasterGetLanguage: + case audioMasterUpdateDisplay: + case audioMasterBeginEdit: + case audioMasterEndEdit: return nullptr; break; default: