Browse Source

Fix potential issue of carla-vst-shell with more than 100 parameters

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.1-rc1
falkTX 5 years ago
parent
commit
0867949a5b
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
1 changed files with 13 additions and 3 deletions
  1. +13
    -3
      source/plugin/carla-vst.cpp

+ 13
- 3
source/plugin/carla-vst.cpp View File

@@ -62,9 +62,13 @@ static uint32_t d_lastBufferSize = 0;
static double d_lastSampleRate = 0.0; static double d_lastSampleRate = 0.0;


static const int32_t kBaseUniqueID = CCONST('C', 'r', 'l', 'a'); static const int32_t kBaseUniqueID = CCONST('C', 'r', 'l', 'a');
static const int32_t kVstMidiEventSize = static_cast<int32_t>(sizeof(VstMidiEvent));

#ifdef CARLA_VST_SHELL
static const int32_t kShellUniqueID = CCONST('C', 'r', 'l', 's'); static const int32_t kShellUniqueID = CCONST('C', 'r', 'l', 's');
#else
static const int32_t kNumParameters = 100; static const int32_t kNumParameters = 100;
static const int32_t kVstMidiEventSize = static_cast<int32_t>(sizeof(VstMidiEvent));
#endif


static const bool kIsUsingUILauncher = isUsingUILauncher(); static const bool kIsUsingUILauncher = isUsingUILauncher();


@@ -250,7 +254,10 @@ public:
break; break;


case effGetParamDisplay: 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) if (char* const cptr = (char*)ptr)
{ {
@@ -308,7 +315,10 @@ public:
break; break;


case effGetParamName: 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) if (char* const cptr = (char*)ptr)
{ {


Loading…
Cancel
Save