1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-02-05 03:50:07 +00:00

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

This commit is contained in:
hogliux 2017-05-10 16:34:44 +01:00
parent b4d655499b
commit 6d54057c7f

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)