Browse Source

VST2: Fixed a nullptr dereference in the VST2 wrapper if hosts supply nullptr buffer

tags/2021-05-28
hogliux 8 years ago
parent
commit
6d54057c7f
1 changed files with 15 additions and 6 deletions
  1. +15
    -6
      modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp

+ 15
- 6
modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp View File

@@ -428,7 +428,8 @@ public:
if (filter->isSuspended())
{
for (int i = 0; i < numOut; ++i)
FloatVectorOperations::clear (outputs[i], numSamples);
if (outputs[i] != nullptr)
FloatVectorOperations::clear (outputs[i], numSamples);
}
else
{
@@ -441,18 +442,26 @@ public:
{
chan = outputs[i];
// if some output channels are disabled, some hosts supply the same buffer
// for multiple channels - this buggers up our method of copying the
// inputs over the outputs, so we need to create unique temp buffers in this case..
bool bufferPointerReusedForOtherChannels = false;
for (int j = i; --j >= 0;)
{
if (outputs[j] == chan)
{
chan = new FloatType [(size_t) blockSize * 2];
tmpBuffers.tempChannels.set (i, chan);
bufferPointerReusedForOtherChannels = true;
break;
}
}
// if some output channels are disabled, some hosts supply the same buffer
// for multiple channels or supply a nullptr - this buggers up our method
// of copying the inputs over the outputs, so we need to create unique temp
// buffers in this case..
if (bufferPointerReusedForOtherChannels || chan == nullptr)
{
chan = new FloatType [(size_t) blockSize * 2];
tmpBuffers.tempChannels.set (i, chan);
}
}
if (i < numIn)


Loading…
Cancel
Save