olilarkin / wdl-ol

Enhanced version of Cockos' iPlug - A simple-to-use C++ framework for developing cross platform audio plugins and targeting multiple plugin APIs with the same code. VST / VST3 / Audiounit / RTAS / AAX (Native) formats supported. NOTE: THIS IS OBSOLETE, PLEASE SEE IPLUG2:
https://github.com/iplug2
935 stars 187 forks source link

IPlugVST3 might crash the Plugin when initalizing reqNumInputChannels or reqNumOutputChannels #60

Open theodark opened 8 years ago

theodark commented 8 years ago

Lines 278 and 279 at IPlugVST3 might cause an access violation if the 'inputs' or 'outputs' arrays are empty (for example in a VST instrument). I've encountered this error in Win x64 Debug configuration of my VST3 plugin.

It would be safer if the code looked if there are any channels initialized and then get their speaker arrangement. For example.

  int32 reqNumInputChannels = 0;
  if(NInChannels() > 0)
      reqNumInputChannels = SpeakerArr::getChannelCount(inputs[0]);  //requested # input channels
  int32 reqNumOutputChannels = 0;
  if(NOutChannels() > 0)
      reqNumOutputChannels = SpeakerArr::getChannelCount(outputs[0]);//requested # output channels