Incorrect Assertion in VSTPluginFormat.cpp

After updating JUCE I’m hitting an assertion in TempChannelPointers which I think is incorrect?
You can see below that pointers is initialised to 128, never resized and then compared with the number of channels in a buffer which will almost always be 128 but the check is that pointers is smaller than the number of channels.

class TempChannelPointers
{
public:
    template <typename T>
    auto getArrayOfModifiableWritePointers (AudioBuffer<T>& buffer)
    {
        auto& pointers = getPointers (Tag<T>{});

        jassert ((int) pointers.size() < buffer.getNumChannels());
        pointers.resize (jmax (pointers.size(), (size_t) buffer.getNumChannels()));

        std::copy (buffer.getArrayOfWritePointers(),
                   buffer.getArrayOfWritePointers() + buffer.getNumChannels(),
                   pointers.begin());

        return pointers.data();
    }

private:
    template <typename> struct Tag {};

    auto& getPointers (Tag<float>)  { return floatPointers; }
    auto& getPointers (Tag<double>) { return doublePointers; }

    std::vector<float*>  floatPointers  { 128 };
    std::vector<double*> doublePointers { 128 };
};

I’m assuming it should be:

jassert (buffer.getNumChannels() <= (int) pointers.size());

?

1 Like

Thanks for reporting. This is now fixed with commit 447c760b on the develop branch.

1 Like

Cheers!