From 671c6a4c1812afb8261a83c3328ce064a7e88bc6 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Sat, 24 Apr 2021 20:27:59 +0200 Subject: [PATCH] Specifically not read data for audioMasterWantMidi Plugsound Free by UVI will pass random garbage to the data parameter for this function call for whatever reason, and we'll run into a memory error if we try to read it. Mentioned in #93. --- CHANGELOG.md | 1 + src/wine-host/bridges/vst2.cpp | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 79373e61..89befce4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,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. ## [3.1.0] - 2021-04-15 diff --git a/src/wine-host/bridges/vst2.cpp b/src/wine-host/bridges/vst2.cpp index 1c47ca82..6376ee38 100644 --- a/src/wine-host/bridges/vst2.cpp +++ b/src/wine-host/bridges/vst2.cpp @@ -482,6 +482,15 @@ class HostCallbackDataConverter : DefaultDataConverter { case audioMasterGetProductString: return WantsString{}; break; + // HACK: 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. + case audioMasterGetSampleRate: + case audioMasterGetBlockSize: + case audioMasterWantMidi: + return nullptr; + break; default: return DefaultDataConverter::read(opcode, index, value, data); break;