From 0867949a5b5d9170f7ae5a12ae8c3ac933127ef9 Mon Sep 17 00:00:00 2001 From: falkTX Date: Fri, 12 Jul 2019 15:17:46 +0200 Subject: [PATCH] Fix potential issue of carla-vst-shell with more than 100 parameters Signed-off-by: falkTX --- source/plugin/carla-vst.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/source/plugin/carla-vst.cpp b/source/plugin/carla-vst.cpp index 292962186..512ffb4d8 100644 --- a/source/plugin/carla-vst.cpp +++ b/source/plugin/carla-vst.cpp @@ -62,9 +62,13 @@ static uint32_t d_lastBufferSize = 0; static double d_lastSampleRate = 0.0; static const int32_t kBaseUniqueID = CCONST('C', 'r', 'l', 'a'); +static const int32_t kVstMidiEventSize = static_cast(sizeof(VstMidiEvent)); + +#ifdef CARLA_VST_SHELL static const int32_t kShellUniqueID = CCONST('C', 'r', 'l', 's'); +#else static const int32_t kNumParameters = 100; -static const int32_t kVstMidiEventSize = static_cast(sizeof(VstMidiEvent)); +#endif static const bool kIsUsingUILauncher = isUsingUILauncher(); @@ -250,7 +254,10 @@ public: break; case effGetParamDisplay: - CARLA_SAFE_ASSERT_RETURN(index >= 0 && index < kNumParameters, 0); + CARLA_SAFE_ASSERT_RETURN(index >= 0, 0); +#ifndef CARLA_VST_SHELL + CARLA_SAFE_ASSERT_RETURN(index < kNumParameters, 0); +#endif if (char* const cptr = (char*)ptr) { @@ -308,7 +315,10 @@ public: break; case effGetParamName: - CARLA_SAFE_ASSERT_RETURN(index >= 0 && index < kNumParameters, 0); + CARLA_SAFE_ASSERT_RETURN(index >= 0, 0); +#ifndef CARLA_VST_SHELL + CARLA_SAFE_ASSERT_RETURN(index < kNumParameters, 0); +#endif if (char* const cptr = (char*)ptr) {